diff --git a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableDay.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableDay.xaml.cs index b7efc4e2..9d175186 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableDay.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableDay.xaml.cs @@ -22,15 +22,24 @@ namespace CampusAppWP8.Pages.TimeTable using CampusAppWP8.Model.TimeTable; using CampusAppWP8.Resources; + /// A time table day. + /// Fiedler, 25.11.2013. + /// public partial class TimeTableDay : PhoneApplicationPage { + /// The pivot item pages. private static readonly int PIVOT_ITEM_PAGES = 5; + /// The pivot item pages half down. private static readonly int PIVOT_ITEM_PAGES_HALF_DOWN = 2; + /// List of items. private ObservableCollection itemList = new ObservableCollection(); + /// Zero-based index of the last selected. private int lastSelectedIndex = 0; - + + /// Initializes a new instance of the TimeTableDay class. + /// Fiedler, 25.11.2013. public TimeTableDay() { this.InitializeComponent(); @@ -73,6 +82,9 @@ namespace CampusAppWP8.Pages.TimeTable ApplicationBar.Buttons.Add(addBtn); } + /// Wird aufgerufen, wenn eine Seite die aktive Seite in einem Frame wird. + /// Fiedler, 25.11.2013. + /// protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); @@ -91,6 +103,29 @@ namespace CampusAppWP8.Pages.TimeTable } } + /// + /// Wird aufgerufen, wenn eine Seite nicht mehr die aktive Seite in einem Frame ist. + /// + /// Fiedler, 25.11.2013. + /// + protected override void OnNavigatedFrom(NavigationEventArgs e) + { + base.OnNavigatedFrom(e); + + List backStack = new List(NavigationService.BackStack); + + if (backStack.Count > 0 + && backStack[0].Source.OriginalString.Contains(Constants.PathTimeTable_Day) + && e.Uri.OriginalString.Contains(Constants.PathTimeTable_Week)) + { + NavigationService.RemoveBackEntry(); + } + } + + /// Event pivot selection changed. + /// Fiedler, 25.11.2013. + /// Source of the event. + /// Selection changed event information. private void EventPivotSelectionChanged(object sender, SelectionChangedEventArgs e) { int indexToChange = 0; @@ -122,6 +157,9 @@ namespace CampusAppWP8.Pages.TimeTable this.lastSelectedIndex = this.ThePivot.SelectedIndex; } + /// Executes the appointment click action. + /// Fiedler, 25.11.2013. + /// The model. private void OnAppointmentClick(AppointmentModel model) { int index = TimeTable.Feed.Model.Appointments.IndexOf(model); @@ -138,6 +176,10 @@ namespace CampusAppWP8.Pages.TimeTable } } + /// Raises the click week event. + /// Fiedler, 25.11.2013. + /// Source of the event. + /// Event information to send to registered event handlers. private void OnClickWeek(object sender, EventArgs e) { Uri url = new Uri(Constants.PathTimeTable_Week, UriKind.Relative); @@ -145,6 +187,10 @@ namespace CampusAppWP8.Pages.TimeTable page.NavigationService.Navigate(url); } + /// Raises the click to day event. + /// Fiedler, 25.11.2013. + /// Source of the event. + /// Event information to send to registered event handlers. private void OnClickToDay(object sender, EventArgs e) { int index = -1; @@ -179,6 +225,10 @@ namespace CampusAppWP8.Pages.TimeTable } } + /// Raises the click properties event. + /// Fiedler, 25.11.2013. + /// Source of the event. + /// Event information to send to registered event handlers. private void OnClickProperties(object sender, EventArgs e) { Uri url = new Uri(Constants.PathTimeTable_Properties, UriKind.Relative); @@ -186,6 +236,10 @@ namespace CampusAppWP8.Pages.TimeTable page.NavigationService.Navigate(url); } + /// Raises the click add event. + /// Fiedler, 25.11.2013. + /// Source of the event. + /// Event information to send to registered event handlers. private void OnClickAdd(object sender, EventArgs e) { TimeTable.Feed.Model.Appointments.CollectionChanged += this.OnListChanged; @@ -195,6 +249,10 @@ namespace CampusAppWP8.Pages.TimeTable page.NavigationService.Navigate(url); } + /// Raises the notify collection changed event. + /// Fiedler, 25.11.2013. + /// Source of the event. + /// Event information to send to registered event handlers. private void OnListChanged(object sender, NotifyCollectionChangedEventArgs e) { if (e.Action == NotifyCollectionChangedAction.Add) @@ -236,6 +294,9 @@ namespace CampusAppWP8.Pages.TimeTable } } + /// Check appointments. + /// Fiedler, 25.11.2013. + /// (Optional) zero-based index of the. private void CheckAppointments(int index = -1) { if (index < 0) diff --git a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableWeek.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableWeek.xaml.cs index 2bbee29b..5b0f6c4c 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableWeek.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableWeek.xaml.cs @@ -98,12 +98,6 @@ namespace CampusAppWP8.Pages.TimeTable } else { - //List backStack = NavigationService.BackStack; - List backStack = new List(NavigationService.BackStack); - JournalEntry entry = backStack[0]; - - Console.Write(entry.ToString()); - this.ThePivot.ItemsSource = this.itemList; this.lastSelectedIndex = PIVOT_PAGES_HALF_DOWN; this.ThePivot.SelectedIndex = PIVOT_PAGES_HALF_DOWN; @@ -121,6 +115,15 @@ namespace CampusAppWP8.Pages.TimeTable { base.OnNavigatedFrom(e); + List backStack = new List(NavigationService.BackStack); + + if (backStack.Count > 0 + && backStack[0].Source.OriginalString.Contains(Constants.PathTimeTable_Week) + && e.Uri.OriginalString.Contains(Constants.PathTimeTable_Day)) + { + NavigationService.RemoveBackEntry(); + } + TimeTable.Feed.SaveData(); }