From e571e3e2e1dc8df38cbe2c77f86ffffebd24fe60 Mon Sep 17 00:00:00 2001 From: Christian Fiedler Date: Tue, 26 Nov 2013 19:06:59 +0100 Subject: [PATCH] daily commit --- .../CampusAppWP8/Pages/Events/EventPage.xaml | 10 +- .../CampusAppWP8/Pages/News/NewsPage.xaml | 10 +- .../CampusAppWP8/Pages/StartPage.xaml.cs | 22 +++-- .../Pages/TimeTable/TimeTableDay.xaml.cs | 8 ++ .../Pages/TimeTable/TimeTableWeek.xaml | 3 +- .../Pages/TimeTable/TimeTableWeek.xaml.cs | 10 +- .../Pages/TimeTable/WeekViewPageItem.cs | 18 ++++ .../CampusAppWP8/Resources/Constants.resx | 3 + .../Resources/Constants1.Designer.cs | 9 ++ .../Utility/Lui/Templates/WeekView.xaml | 17 ++-- .../Utility/Lui/Templates/WeekView.xaml.cs | 20 +++- .../Utility/Lui/Templates/WeekViewDay.xaml | 3 +- .../Utility/Lui/Templates/WeekViewDay.xaml.cs | 92 +++++++++++++++++-- 13 files changed, 193 insertions(+), 32 deletions(-) diff --git a/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml index 48d690c0..1d7123bb 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml @@ -8,12 +8,18 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:header="clr-namespace:CampusAppWP8.Utility.Lui.Header" xmlns:page="clr-namespace:CampusAppWP8.Utility.Lui.Page" + xmlns:conv="clr-namespace:CampusAppWP8.Utility.Converter" mc:Ignorable="d" FontFamily="{StaticResource PhoneFontFamilyNormal}" FontSize="{StaticResource PhoneFontSizeNormal}" Foreground="{StaticResource PhoneForegroundBrush}" SupportedOrientations="PortraitOrLandscape" Orientation="Portrait" shell:SystemTray.IsVisible="True"> + + + + + @@ -40,7 +46,7 @@ - + @@ -52,7 +58,7 @@ - + diff --git a/CampusAppWP8/CampusAppWP8/Pages/News/NewsPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/News/NewsPage.xaml index 5e8423ff..627f2710 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/News/NewsPage.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/News/NewsPage.xaml @@ -8,12 +8,18 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:header="clr-namespace:CampusAppWP8.Utility.Lui.Header" xmlns:page="clr-namespace:CampusAppWP8.Utility.Lui.Page" + xmlns:conv="clr-namespace:CampusAppWP8.Utility.Converter" mc:Ignorable="d" FontFamily="{StaticResource PhoneFontFamilyNormal}" FontSize="{StaticResource PhoneFontSizeNormal}" Foreground="{StaticResource PhoneForegroundBrush}" SupportedOrientations="PortraitOrLandscape" Orientation="Portrait" shell:SystemTray.IsVisible="True"> + + + + + @@ -39,7 +45,7 @@ - + @@ -51,7 +57,7 @@ - + diff --git a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs index 0d93b06d..5cbdb32b 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs @@ -345,25 +345,29 @@ namespace CampusAppWP8.Pages } } - #endregion - + /// Event handler. Called by TimeTable for click events. + /// Fiedler, 26.11.2013. + /// Caller of the function. + /// Routed event information. private void TimeTable_Click(object sender, RoutedEventArgs e) { - if(this.Orientation.Equals(PageOrientation.Landscape) + if (this.Orientation.Equals(PageOrientation.Landscape) || this.Orientation.Equals(PageOrientation.LandscapeLeft) || this.Orientation.Equals(PageOrientation.LandscapeRight)) { this.TimeTableAppButton.Url = Constants.PathTimeTable_Week; } else - if(this.Orientation.Equals(PageOrientation.Portrait) - || this.Orientation.Equals(PageOrientation.PortraitDown) - || this.Orientation.Equals(PageOrientation.PortraitUp)) - { - this.TimeTableAppButton.Url = Constants.PathTimeTable_Day; - } + if (this.Orientation.Equals(PageOrientation.Portrait) + || this.Orientation.Equals(PageOrientation.PortraitDown) + || this.Orientation.Equals(PageOrientation.PortraitUp)) + { + this.TimeTableAppButton.Url = Constants.PathTimeTable_Day; + } } #endregion + + #endregion } } \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableDay.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableDay.xaml.cs index 0b1998ba..1f24fea3 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableDay.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableDay.xaml.cs @@ -95,6 +95,14 @@ namespace CampusAppWP8.Pages.TimeTable } else { + string dayStr = string.Empty; + + if (NavigationContext.QueryString.TryGetValue(Constants.ParamDay, out dayStr)) + { + + + } + this.ThePivot.ItemsSource = this.itemList; this.lastSelectedIndex = PIVOT_ITEM_PAGES_HALF_DOWN; this.ThePivot.SelectedIndex = PIVOT_ITEM_PAGES_HALF_DOWN; diff --git a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableWeek.xaml b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableWeek.xaml index f72c89ba..07e8188d 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableWeek.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableWeek.xaml @@ -34,7 +34,8 @@ Appointments="{Binding Path=AppointmentList, Mode=OneWay}" WeekNumber="{Binding Path=WeekNr, Mode=OneWay}" Days="5" - ToDayColoring="True"/> + ToDayColoring="True" + SelectedDay="{Binding Path=SelectedDay, Mode=TwoWay}"/> diff --git a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableWeek.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableWeek.xaml.cs index 4dfe2080..6a7e8cb0 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableWeek.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableWeek.xaml.cs @@ -398,7 +398,15 @@ namespace CampusAppWP8.Pages.TimeTable || e.Orientation.Equals(PageOrientation.PortraitDown) || e.Orientation.Equals(PageOrientation.PortraitUp)) { - NavigationService.Navigate(new Uri(Constants.PathTimeTable_Day, UriKind.Relative)); + string url = Constants.PathTimeTable_Day; + + if ((this.ThePivot.SelectedItem as WeekViewPageItem).SelectedDay.Date.Equals(DateTime.MinValue.Date) == false) + { + url += "?" + Constants.ParamDay + "=" + (this.ThePivot.SelectedItem as WeekViewPageItem).SelectedDay.ToLongDateString(); + } + + Uri newUri = new Uri(url , UriKind.Relative); + NavigationService.Navigate(newUri); } } } diff --git a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/WeekViewPageItem.cs b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/WeekViewPageItem.cs index a5564e04..727bdced 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/WeekViewPageItem.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/WeekViewPageItem.cs @@ -34,6 +34,9 @@ namespace CampusAppWP8.Pages.TimeTable /// List of appointments. private ObservableCollection appointmentList = null; + /// The selected day. + private DateTime selectedDay = DateTime.MinValue; + /// Tritt ein, wenn sich ein Eigenschaftswert ändert. public event PropertyChangedEventHandler PropertyChanged; @@ -149,6 +152,21 @@ namespace CampusAppWP8.Pages.TimeTable } } + /// Gets or sets the selected day. + /// The selected day. + public DateTime SelectedDay + { + get + { + return this.selectedDay; + } + + set + { + this.selectedDay = value; + } + } + /// Notifies a property changed. /// Fiedler, 06.11.2013. /// The information. diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx index 5f02e256..7d33c11c 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx +++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx @@ -678,4 +678,7 @@ MensaDefaultCampus + + paramday + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs index 4b3fe01c..c8de4712 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs +++ b/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs @@ -717,6 +717,15 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die paramday ähnelt. + /// + public static string ParamDay { + get { + return ResourceManager.GetString("ParamDay", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die Studiengang ähnelt. /// diff --git a/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekView.xaml b/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekView.xaml index 3e102a12..255064d7 100644 --- a/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekView.xaml +++ b/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekView.xaml @@ -10,7 +10,8 @@ FontFamily="{StaticResource PhoneFontFamilyNormal}" FontSize="{StaticResource PhoneFontSizeNormal}" Foreground="{StaticResource PhoneForegroundBrush}" - x:Name="root"> + x:Name="root" + > @@ -178,31 +179,31 @@ - + - + - + - + - + - + - + diff --git a/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekView.xaml.cs b/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekView.xaml.cs index 0dbeb5e8..b54f1324 100644 --- a/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekView.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekView.xaml.cs @@ -37,10 +37,15 @@ namespace CampusAppWP8.Utility.Lui.Templates /// The week number property. public static readonly DependencyProperty WeekNumberProperty = DependencyProperty.Register("WeekNumber", typeof(int), typeof(WeekView), new PropertyMetadata(-1)); + /// The head visible property. public static readonly DependencyProperty HeadVisibleProperty = DependencyProperty.Register("HeadVisible", typeof(bool), typeof(WeekView), new PropertyMetadata(true)); + /// to day coloring property. public static readonly DependencyProperty ToDayColoringProperty = DependencyProperty.Register("ToDayColoring", typeof(bool), typeof(WeekView), new PropertyMetadata(false)); - + + /// The selected day property. + public static readonly DependencyProperty SelectedDayProperty = DependencyProperty.Register("SelectedDay", typeof(DateTime), typeof(WeekView), new PropertyMetadata(null)); + /// List of borders. private List borderList = new List(); /// List of days. @@ -390,6 +395,19 @@ namespace CampusAppWP8.Utility.Lui.Templates } } + public DateTime SelectedDay + { + get + { + return (DateTime)this.GetValue(SelectedDayProperty); + } + + set + { + this.SetValue(SelectedDayProperty, value); + } + } + /// Sets column background. /// Fiedler, 06.11.2013. /// The column. diff --git a/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekViewDay.xaml b/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekViewDay.xaml index 6cbe6cea..db9927df 100644 --- a/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekViewDay.xaml +++ b/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekViewDay.xaml @@ -33,7 +33,8 @@ Canvas.ZIndex="1" Height="{Binding Path=ActualHeight, ElementName=MainCanvas, Mode=OneWay}" Width="{Binding Path=Width, ElementName=MainCanvas, Mode=OneWay, Converter={StaticResource NaNConverter}}" - /> + Tap="BGCanvas_Tap" + Background="Transparent"/> The appointments property. public static readonly DependencyProperty AppointmentsProperty = DependencyProperty.Register("Appointments", typeof(ObservableCollection), typeof(WeekViewDay), new PropertyMetadata(null, OnAppointmentsChanged)); + /// The selected date property. + public static readonly DependencyProperty SelectedDateProperty = DependencyProperty.Register("SelectedDate", typeof(DateTime), typeof(WeekViewDay), new PropertyMetadata(DateTime.MinValue, OnSelectedDateChanged)); + + /// The selected property. + public static readonly DependencyProperty SelectedProperty = DependencyProperty.Register("Selected", typeof(bool), typeof(WeekViewDay), new PropertyMetadata(false)); + /// The stacks. private List> stacks = new List>(); @@ -79,6 +85,43 @@ namespace CampusAppWP8.Utility.Lui.Templates } } + /// Raises the dependency property changed event. + /// Fiedler, 26.11.2013. + /// The DependencyObject to process. + /// Event information to send to registered event handlers. + private static void OnSelectedDateChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) + { + if (e.NewValue != null && e.OldValue != null) + { + if (((DateTime)e.NewValue).Date.Equals((o as WeekViewDay).Date.Date) + && ((DateTime)e.OldValue).Date.Equals((o as WeekViewDay).Date.Date)) + { + return; + } + } + + if (e.NewValue != null) + { + if (((DateTime)e.NewValue).Date.Equals((o as WeekViewDay).Date.Date)) + { + SolidColorBrush newBG = new SolidColorBrush(Colors.LightGray); + newBG.Opacity = 0.5; + + (o as WeekViewDay).BGCanvas.Background = newBG; + } + } + + if (e.OldValue != null) + { + if (((DateTime)e.OldValue).Date.Equals((o as WeekViewDay).Date.Date)) + { + SolidColorBrush newBG = new SolidColorBrush(Colors.Transparent); + + (o as WeekViewDay).BGCanvas.Background = newBG; + } + } + } + /// Raises the notify collection changed event. /// Fiedler, 06.11.2013. /// The object to process. @@ -178,6 +221,43 @@ namespace CampusAppWP8.Utility.Lui.Templates } } + /// Gets or sets the selected date. + /// The selected date. + public DateTime SelectedDate + { + get + { + return (DateTime)this.GetValue(SelectedDateProperty); + } + + set + { + this.SetValue(SelectedDateProperty, value); + } + } + + /// Gets or sets a value indicating whether the selected. + /// true if selected, false if not. + public bool Selected + { + get + { + return (this.Date.Date.Equals(this.SelectedDate.Date)); + } + + set + { + if (value == true) + { + this.SelectedDate = this.Date; + } + else + { + this.SelectedDate = DateTime.MinValue; + } + } + } + /// Check stack add. /// Fiedler, 06.11.2013. /// The model. @@ -422,13 +502,6 @@ namespace CampusAppWP8.Utility.Lui.Templates } } - /* - protected override void OnDoubleTap(System.Windows.Input.GestureEventArgs e) - { - base.OnDoubleTap(e); - } - */ - /// Draw lines. /// Fiedler, 22.10.2013. private void DrawLines() @@ -465,5 +538,10 @@ namespace CampusAppWP8.Utility.Lui.Templates } } } + + private void BGCanvas_Tap(object sender, System.Windows.Input.GestureEventArgs e) + { + this.Selected = true; + } } }