diff --git a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj
index 4a4ad608..e25ce946 100644
--- a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj
+++ b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj
@@ -140,6 +140,9 @@
TimeTableDay.xaml
+
+ TimeTableProperties.xaml
+
@@ -461,6 +464,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
MSBuild:Compile
Designer
diff --git a/CampusAppWP8/CampusAppWP8/Model/TimeTable/AppointmentModel.cs b/CampusAppWP8/CampusAppWP8/Model/TimeTable/AppointmentModel.cs
index efd3881d..0ffd46a6 100644
--- a/CampusAppWP8/CampusAppWP8/Model/TimeTable/AppointmentModel.cs
+++ b/CampusAppWP8/CampusAppWP8/Model/TimeTable/AppointmentModel.cs
@@ -109,6 +109,8 @@ namespace CampusAppWP8.Model.TimeTable
this.rect.StrokeThickness = 1;
this.rect.Stroke = new SolidColorBrush(Colors.DarkGray);
this.rect.Fill = new SolidColorBrush(Colors.Green);
+ this.rect.RadiusX = 10;
+ this.rect.RadiusY = 10;
this.canvas.Children.Add(this.rect);
@@ -123,8 +125,8 @@ namespace CampusAppWP8.Model.TimeTable
txtTitle.FontWeight = FontWeights.Bold;
txtTitle.TextWrapping = TextWrapping.Wrap;
txtTitle.Width = this.rect.Width - 4.0;
- txtTitle.SetValue(Canvas.LeftProperty, 2.0);
- txtTitle.SetValue(Canvas.TopProperty, 2.0);
+ txtTitle.SetValue(Canvas.LeftProperty, 5.0);
+ txtTitle.SetValue(Canvas.TopProperty, 5.0);
/*
Description desc = eventObj.GetProperty(ICSTag.DESCRIPTION) as Description;
diff --git a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTable.cs b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTable.cs
index c5d72364..8730f690 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTable.cs
+++ b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTable.cs
@@ -31,6 +31,8 @@ namespace CampusAppWP8.Pages.TimeTable
new AppointmentModel("BEGIN:VCALENDAR\r\nPRODID:-//bobbin v0.1//NONSGML iCal Writer//EN\r\nVERSION:2.0\r\nCALSCALE:GREGORIAN\r\nMETHOD:PUBLISH\r\nBEGIN:VEVENT\r\nDTSTART:20130918T080000Z\r\nDTEND:20130918T110000Z\r\nDTSTAMP:20091130T213238Z\r\nUID:1285935469767a7c7c1a9b3f0df8003a@yoursever.com\r\nCREATED:20091130T213238Z\r\nDESCRIPTION:Example event 1\r\nLAST-MODIFIED:20091130T213238Z\r\nSEQUENCE:0\r\nSTATUS:CONFIRMED\r\nSUMMARY:Example event 1\r\nTRANSP:OPAQUE\r\nEND:VEVENT\r\nEND:VCALENDAR")
});
+ public static int AutoScrollToHour = 7;
+
public TimeTable()
{
//this.InitializeComponent();
@@ -38,11 +40,6 @@ namespace CampusAppWP8.Pages.TimeTable
TimeTable.appList = new AppointmentListModel();
}
- protected override void OnNavigatedTo(NavigationEventArgs e)
- {
- base.OnNavigatedTo(e);
- }
-
public static AppointmentListModel AppointmentsModel
{
get
diff --git a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableDay.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableDay.xaml.cs
index 8156cc2d..62588d30 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableDay.xaml.cs
+++ b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableDay.xaml.cs
@@ -25,11 +25,9 @@ namespace CampusAppWP8.Pages.TimeTable
private readonly double DAY_TABLE_INNER_THICKNESS = 1;
private static readonly int PIVOT_ITEM_PAGES = 5;
- private static readonly int PIVOT_ITEM_PAGES_HALF_UP = 3;
+ //private static readonly int PIVOT_ITEM_PAGES_HALF_UP = 4;
private static readonly int PIVOT_ITEM_PAGES_HALF_DOWN = 2;
- private bool DayLayoutDone = false;
-
private PivotItem[] itemPages = new PivotItem[PIVOT_ITEM_PAGES];
private DateTime[] itemDate = new DateTime[PIVOT_ITEM_PAGES];
private DateTime itemPage_0_Day = DateTime.Now.AddDays(PIVOT_ITEM_PAGES_HALF_DOWN * -1);
@@ -44,7 +42,6 @@ namespace CampusAppWP8.Pages.TimeTable
{
this.itemPages[i] = new PivotItem();
this.itemDate[i] = itemPage_0_Day.AddDays(i);
- this.SetupItemPageBackground(this.itemPages[i], this.itemDate[i]);
this.ThePivot.Items.Add(this.itemPages[i]);
}
@@ -57,6 +54,12 @@ namespace CampusAppWP8.Pages.TimeTable
editBtn.Text = AppResources.ToDay;
editBtn.Click += new EventHandler(this.OnClickToDay);
ApplicationBar.Buttons.Add(editBtn);
+
+ ApplicationBarIconButton propBtn = new ApplicationBarIconButton();
+ propBtn.IconUri = new Uri(Icons.Link, UriKind.Relative);
+ propBtn.Text = AppResources.Properties;
+ propBtn.Click += new EventHandler(this.OnClickProperties);
+ ApplicationBar.Buttons.Add(propBtn);
}
protected override void OnNavigatedTo(NavigationEventArgs e)
@@ -74,45 +77,56 @@ namespace CampusAppWP8.Pages.TimeTable
this.SetupItemPage(i, this.itemDate[i]);
}
}
- this.DayLayoutDone = true;
}
private void EventPivotSelectionChanged(object sender, SelectionChangedEventArgs e)
{
- int[] indexToChange = new int[2];
+ int indexToChange = 0;
/*
- 0: 2,3
- 1: 3,4
- 2: 4,0
- 3: 0,1
- 4: 1,2
+ =>
+ 0->1: 3
+ 1->2: 4
+ 2->3: 0
+ 3->4: 1
+ 4->0: 2
+
+ <=
+ 4<-0: 2
+ 3<-4: 1
+ 2<-3: 0
+ 1<-2: 4
+ 0<-1: 3
+ *
+ *
+ (0)1 2|3 4
+ 0(1)2 3|4
+ 0 1(2)3 4|
+ 0|1 2(3)4
+ 0 1|2 3(4)
*/
int delta = this.ThePivot.SelectedIndex - this.lastSelectedIndex;
+ if ((this.ThePivot.SelectedIndex == 0) && (this.lastSelectedIndex == (PIVOT_ITEM_PAGES - 1)))
+ {
+ delta = 1;
+ }
+ else if ((this.ThePivot.SelectedIndex == (PIVOT_ITEM_PAGES - 1)) && (this.lastSelectedIndex == 0))
+ {
+ delta = -1;
+ }
+
if (Math.Abs(delta) > 1)
{
delta = (delta < 0) ? -1 : 1;
}
-
- indexToChange[0] = (this.ThePivot.SelectedIndex + PIVOT_ITEM_PAGES_HALF_DOWN) % PIVOT_ITEM_PAGES;
- indexToChange[1] = (indexToChange[0] + 1) % PIVOT_ITEM_PAGES;
-
- for (int i = 0; i < indexToChange.Count(); i++)
- {
- if (delta < 0)
- {
- this.itemDate[indexToChange[1 - i]] = this.itemDate[this.ThePivot.SelectedIndex].AddDays(delta * (PIVOT_ITEM_PAGES_HALF_DOWN + i));
- this.SetupItemPage(indexToChange[1 - i], this.itemDate[indexToChange[1 - i]]);
- }
- else
- {
- this.itemDate[indexToChange[i]] = this.itemDate[this.ThePivot.SelectedIndex].AddDays(delta * (PIVOT_ITEM_PAGES_HALF_DOWN + i));
- this.SetupItemPage(indexToChange[i], this.itemDate[indexToChange[i]]);
- }
- }
-
+
+ indexToChange = (this.ThePivot.SelectedIndex + PIVOT_ITEM_PAGES + (PIVOT_ITEM_PAGES_HALF_DOWN * delta)) % PIVOT_ITEM_PAGES;
+
+ this.itemDate[indexToChange] = this.itemDate[this.ThePivot.SelectedIndex].AddDays(delta * PIVOT_ITEM_PAGES_HALF_DOWN);
+ this.SetupItemPage(indexToChange, this.itemDate[indexToChange]);
+
this.lastSelectedIndex = this.ThePivot.SelectedIndex;
}
@@ -130,6 +144,16 @@ namespace CampusAppWP8.Pages.TimeTable
}
}
+ private void EventOnMultiBubbleClick(int stackID)
+ {
+
+ }
+
+ private void EventAutoScroll(object sender, RoutedEventArgs e)
+ {
+ (sender as ScrollViewer).ScrollToVerticalOffset(DAY_TABLE_CELL_HEIGHT * TimeTable.AutoScrollToHour);
+ }
+
private void OnClickToDay(object sender, EventArgs e)
{
this.itemPage_0_Day = DateTime.Now.AddDays(PIVOT_ITEM_PAGES_HALF_DOWN * -1);
@@ -142,24 +166,23 @@ namespace CampusAppWP8.Pages.TimeTable
}
}
- private void AutoScrollToDay(object sender, EventArgs e)
+ private void OnClickProperties(object sender, EventArgs e)
{
- if (this.DayLayoutDone == true)
- {
- for (int i = 0; i < PIVOT_ITEM_PAGES; i++)
- {
- (this.itemPages[i].Content as ScrollViewer).ScrollToVerticalOffset(DAY_TABLE_CELL_HEIGHT * 7);
- }
- this.DayLayoutDone = false;
- //this.DayScroll.LayoutUpdated -= this.AutoScrollToDay;
- }
+ Uri url = new Uri("/Pages/TimeTable/TimeTableProperties.xaml", UriKind.Relative);
+ Page page = App.RootFrame.Content as Page;
+ page.NavigationService.Navigate(url);
}
private void SetupItemPage(int index, DateTime date)
{
this.itemPages[index].Header = string.Format("{0:ddd dd.MM.yy}", date);
- ((this.itemPages[index].Content as ScrollViewer).Content as Canvas).Children.Clear();
+ if (this.itemPages[index].Content != null)
+ {
+ ((this.itemPages[index].Content as ScrollViewer).Content as Canvas).Children.Clear();
+ }
+
+ this.SetupItemPageBackground(this.itemPages[index]);
for (int i = 0; i < TimeTable.AppointmentsModel.Appointments.Count(); i++)
{
@@ -170,7 +193,7 @@ namespace CampusAppWP8.Pages.TimeTable
TimeTable.AppointmentsModel.Appointments[i].OnClick += new AppointmentModel.OnAppointmentClick(this.EventOnAppointmentClick);
Canvas temp = TimeTable.AppointmentsModel.Appointments[i].GetCanvas();
temp.Margin = new Thickness(DAY_TABLE_HEAD_WIDTH + 2, TimeTable.AppointmentsModel.Appointments[i].GetYOffset, 0, 0);
-// ((this.itemPages[index].Content as ScrollViewer).Content as Canvas).Children.Add(temp);
+ ((this.itemPages[index].Content as ScrollViewer).Content as Canvas).Children.Add(temp);
/*
temp = this.testMod2.GetCanvas();
@@ -181,17 +204,46 @@ namespace CampusAppWP8.Pages.TimeTable
}
}
- private void SetupItemPageBackground(PivotItem item, DateTime date)
+ private void SetupItemPageBackground(PivotItem item)
{
ScrollViewer sv = new ScrollViewer();
Canvas ca = new Canvas();
this.DrawDayViewBackground(ca);
sv.Content = ca;
- sv.LayoutUpdated += new EventHandler(this.AutoScrollToDay);
+ sv.Loaded += new RoutedEventHandler(this.EventAutoScroll);
item.Content = sv;
}
+ private void DrawMultiBubble(Canvas dayView, int stackIndex, int number, int yOffset)
+ {
+ Canvas can = new Canvas();
+
+ Rectangle rect = new Rectangle();
+ rect.Width = 50;
+ rect.Height = 50;
+ rect.RadiusX = 25;
+ rect.RadiusY = 25;
+ rect.StrokeThickness = 1;
+ rect.Stroke = new SolidColorBrush(Colors.DarkGray);
+ rect.Fill = new SolidColorBrush(Colors.Blue);
+
+ TextBlock block = new TextBlock();
+ block.Text = "" + number;
+ block.HorizontalAlignment = HorizontalAlignment.Center;
+ block.VerticalAlignment = VerticalAlignment.Center;
+ block.Height = 50;
+ block.Width = 50;
+ block.FontWeight = FontWeights.Bold;
+
+ can.Children.Add(rect);
+ can.Children.Add(block);
+// can.
+// .DoubleTap += new EventHandler(this.OnCanvasClick);
+
+ dayView.Children.Add(can);
+ }
+
private void DrawDayViewBackground(Canvas dayView)
{
dayView.Height = DAY_TABLE_CELL_HEIGHT * 24;
diff --git a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableProperties.xaml b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableProperties.xaml
new file mode 100644
index 00000000..2948828c
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableProperties.xaml
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableProperties.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableProperties.xaml.cs
new file mode 100644
index 00000000..2c8030bb
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableProperties.xaml.cs
@@ -0,0 +1,37 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Navigation;
+using Microsoft.Phone.Controls;
+using Microsoft.Phone.Shell;
+
+namespace CampusAppWP8.Pages.TimeTable
+{
+ public partial class TimeTableProperties : PhoneApplicationPage
+ {
+ public TimeTableProperties()
+ {
+ this.InitializeComponent();
+
+ string[] tempAutoScroll = new string[25];
+
+ for (int i = 0; i < 24; i++)
+ {
+ tempAutoScroll[i] = "" + i;
+ }
+
+ this.AutoScroll.ItemsSource = tempAutoScroll;
+ this.AutoScroll.SelectedIndex = TimeTable.AutoScrollToHour;
+ }
+
+ protected override void OnNavigatedFrom(NavigationEventArgs e)
+ {
+ base.OnNavigatedFrom(e);
+
+ TimeTable.AutoScrollToHour = this.AutoScroll.SelectedIndex;
+ }
+ }
+}
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs
index 9feb0376..4552b3ef 100644
--- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs
+++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs
@@ -105,6 +105,15 @@ namespace CampusAppWP8.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die Automatisch scrollen zur Stunde ähnelt.
+ ///
+ public static string AutoScrollToHour {
+ get {
+ return ResourceManager.GetString("AutoScrollToHour", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die Gebäude ähnelt.
///
@@ -798,6 +807,15 @@ namespace CampusAppWP8.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die Einstellungen ähnelt.
+ ///
+ public static string Properties {
+ get {
+ return ResourceManager.GetString("Properties", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die ... suche ähnelt.
///
diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx
index 30bc0fea..7d66714a 100644
--- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx
+++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx
@@ -461,4 +461,10 @@
Bitte halten Sie das Handy vor dem NFC-Tag
+
+ Automatisch scrollen zur Stunde
+
+
+ Einstellungen
+
\ No newline at end of file