Merge branch 'feature/#285' into develop
This commit is contained in:
@@ -22,15 +22,24 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
using CampusAppWP8.Model.TimeTable;
|
||||
using CampusAppWP8.Resources;
|
||||
|
||||
/// <summary> A time table day. </summary>
|
||||
/// <remarks> Fiedler, 25.11.2013. </remarks>
|
||||
/// <seealso cref="T:Microsoft.Phone.Controls.PhoneApplicationPage"/>
|
||||
public partial class TimeTableDay : PhoneApplicationPage
|
||||
{
|
||||
/// <summary> The pivot item pages. </summary>
|
||||
private static readonly int PIVOT_ITEM_PAGES = 5;
|
||||
/// <summary> The pivot item pages half down. </summary>
|
||||
private static readonly int PIVOT_ITEM_PAGES_HALF_DOWN = 2;
|
||||
|
||||
/// <summary> List of items. </summary>
|
||||
private ObservableCollection<DayViewPageItem> itemList = new ObservableCollection<DayViewPageItem>();
|
||||
|
||||
/// <summary> Zero-based index of the last selected. </summary>
|
||||
private int lastSelectedIndex = 0;
|
||||
|
||||
|
||||
/// <summary> Initializes a new instance of the TimeTableDay class. </summary>
|
||||
/// <remarks> Fiedler, 25.11.2013. </remarks>
|
||||
public TimeTableDay()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
@@ -73,6 +82,9 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
ApplicationBar.Buttons.Add(addBtn);
|
||||
}
|
||||
|
||||
/// <summary> Wird aufgerufen, wenn eine Seite die aktive Seite in einem Frame wird. </summary>
|
||||
/// <remarks> Fiedler, 25.11.2013. </remarks>
|
||||
/// <seealso cref="M:System.Windows.Controls.Page.OnNavigatedTo(NavigationEventArgs)"/>
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
base.OnNavigatedTo(e);
|
||||
@@ -91,6 +103,29 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wird aufgerufen, wenn eine Seite nicht mehr die aktive Seite in einem Frame ist.
|
||||
/// </summary>
|
||||
/// <remarks> Fiedler, 25.11.2013. </remarks>
|
||||
/// <seealso cref="M:System.Windows.Controls.Page.OnNavigatedFrom(NavigationEventArgs)"/>
|
||||
protected override void OnNavigatedFrom(NavigationEventArgs e)
|
||||
{
|
||||
base.OnNavigatedFrom(e);
|
||||
|
||||
List<JournalEntry> backStack = new List<JournalEntry>(NavigationService.BackStack);
|
||||
|
||||
if (backStack.Count > 0
|
||||
&& backStack[0].Source.OriginalString.Contains(Constants.PathTimeTable_Day)
|
||||
&& e.Uri.OriginalString.Contains(Constants.PathTimeTable_Week))
|
||||
{
|
||||
NavigationService.RemoveBackEntry();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Event pivot selection changed. </summary>
|
||||
/// <remarks> Fiedler, 25.11.2013. </remarks>
|
||||
/// <param name="sender"> Source of the event. </param>
|
||||
/// <param name="e"> Selection changed event information. </param>
|
||||
private void EventPivotSelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
int indexToChange = 0;
|
||||
@@ -122,6 +157,9 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
this.lastSelectedIndex = this.ThePivot.SelectedIndex;
|
||||
}
|
||||
|
||||
/// <summary> Executes the appointment click action. </summary>
|
||||
/// <remarks> Fiedler, 25.11.2013. </remarks>
|
||||
/// <param name="model"> The model. </param>
|
||||
private void OnAppointmentClick(AppointmentModel model)
|
||||
{
|
||||
int index = TimeTable.Feed.Model.Appointments.IndexOf(model);
|
||||
@@ -138,6 +176,10 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Raises the click week event. </summary>
|
||||
/// <remarks> Fiedler, 25.11.2013. </remarks>
|
||||
/// <param name="sender"> Source of the event. </param>
|
||||
/// <param name="e"> Event information to send to registered event handlers. </param>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary> Raises the click to day event. </summary>
|
||||
/// <remarks> Fiedler, 25.11.2013. </remarks>
|
||||
/// <param name="sender"> Source of the event. </param>
|
||||
/// <param name="e"> Event information to send to registered event handlers. </param>
|
||||
private void OnClickToDay(object sender, EventArgs e)
|
||||
{
|
||||
int index = -1;
|
||||
@@ -179,6 +225,10 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Raises the click properties event. </summary>
|
||||
/// <remarks> Fiedler, 25.11.2013. </remarks>
|
||||
/// <param name="sender"> Source of the event. </param>
|
||||
/// <param name="e"> Event information to send to registered event handlers. </param>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary> Raises the click add event. </summary>
|
||||
/// <remarks> Fiedler, 25.11.2013. </remarks>
|
||||
/// <param name="sender"> Source of the event. </param>
|
||||
/// <param name="e"> Event information to send to registered event handlers. </param>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary> Raises the notify collection changed event. </summary>
|
||||
/// <remarks> Fiedler, 25.11.2013. </remarks>
|
||||
/// <param name="sender"> Source of the event. </param>
|
||||
/// <param name="e"> Event information to send to registered event handlers. </param>
|
||||
private void OnListChanged(object sender, NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
if (e.Action == NotifyCollectionChangedAction.Add)
|
||||
@@ -236,6 +294,9 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Check appointments. </summary>
|
||||
/// <remarks> Fiedler, 25.11.2013. </remarks>
|
||||
/// <param name="index"> (Optional) zero-based index of the. </param>
|
||||
private void CheckAppointments(int index = -1)
|
||||
{
|
||||
if (index < 0)
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
namespace CampusAppWP8.Pages.TimeTable
|
||||
{
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Windows;
|
||||
@@ -20,15 +22,24 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
using CampusAppWP8.Model.TimeTable;
|
||||
using CampusAppWP8.Resources;
|
||||
|
||||
/// <summary> A time table week. </summary>
|
||||
/// <remarks> Fiedler, 22.11.2013. </remarks>
|
||||
/// <seealso cref="T:Microsoft.Phone.Controls.PhoneApplicationPage"/>
|
||||
public partial class TimeTableWeek : PhoneApplicationPage
|
||||
{
|
||||
/// <summary> The pivot pages. </summary>
|
||||
private static readonly int PIVOT_PAGES = 3;
|
||||
/// <summary> The pivot pages half down. </summary>
|
||||
private static readonly int PIVOT_PAGES_HALF_DOWN = 1;
|
||||
|
||||
/// <summary> Zero-based index of the last selected. </summary>
|
||||
private int lastSelectedIndex = 0;
|
||||
|
||||
/// <summary> List of items. </summary>
|
||||
private ObservableCollection<WeekViewPageItem> itemList = new ObservableCollection<WeekViewPageItem>();
|
||||
|
||||
/// <summary> Initializes a new instance of the TimeTableWeek class. </summary>
|
||||
/// <remarks> Fiedler, 22.11.2013. </remarks>
|
||||
public TimeTableWeek()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
@@ -74,6 +85,9 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
ApplicationBar.Buttons.Add(addBtn);
|
||||
}
|
||||
|
||||
/// <summary> Wird aufgerufen, wenn eine Seite die aktive Seite in einem Frame wird. </summary>
|
||||
/// <remarks> Fiedler, 22.11.2013. </remarks>
|
||||
/// <seealso cref="M:System.Windows.Controls.Page.OnNavigatedTo(NavigationEventArgs)"/>
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
base.OnNavigatedTo(e);
|
||||
@@ -92,13 +106,31 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wird aufgerufen, wenn eine Seite nicht mehr die aktive Seite in einem Frame ist.
|
||||
/// </summary>
|
||||
/// <remarks> Fiedler, 22.11.2013. </remarks>
|
||||
/// <seealso cref="M:System.Windows.Controls.Page.OnNavigatedFrom(NavigationEventArgs)"/>
|
||||
protected override void OnNavigatedFrom(NavigationEventArgs e)
|
||||
{
|
||||
base.OnNavigatedFrom(e);
|
||||
|
||||
List<JournalEntry> backStack = new List<JournalEntry>(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();
|
||||
}
|
||||
|
||||
/// <summary> Gets the first day of week. </summary>
|
||||
/// <remarks> Fiedler, 22.11.2013. </remarks>
|
||||
/// <param name="dayInWeek"> The day in week Date/Time. </param>
|
||||
/// <returns> The first day of week. </returns>
|
||||
private DateTime GetFirstDayOfWeek(DateTime dayInWeek)
|
||||
{
|
||||
DateTime retValue = dayInWeek.Date;
|
||||
@@ -111,6 +143,10 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
return retValue;
|
||||
}
|
||||
|
||||
/// <summary> Gets week number. </summary>
|
||||
/// <remarks> Fiedler, 22.11.2013. </remarks>
|
||||
/// <param name="date"> The date Date/Time. </param>
|
||||
/// <returns> The week number. </returns>
|
||||
private int GetWeekNumber(DateTime date)
|
||||
{
|
||||
int retValue = 0;
|
||||
@@ -121,6 +157,10 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
return retValue;
|
||||
}
|
||||
|
||||
/// <summary> Gets day of week index. </summary>
|
||||
/// <remarks> Fiedler, 22.11.2013. </remarks>
|
||||
/// <param name="dayInWeek"> The day in week Date/Time. </param>
|
||||
/// <returns> The day of week index. </returns>
|
||||
private int GetDayOfWeekIndex(DateTime dayInWeek)
|
||||
{
|
||||
int retValue = -1;
|
||||
@@ -139,6 +179,10 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
return retValue;
|
||||
}
|
||||
|
||||
/// <summary> Raises the click day view event. </summary>
|
||||
/// <remarks> Fiedler, 22.11.2013. </remarks>
|
||||
/// <param name="sender"> Source of the event. </param>
|
||||
/// <param name="e"> Event information to send to registered event handlers. </param>
|
||||
private void OnClickDayView(object sender, EventArgs e)
|
||||
{
|
||||
Uri url = new Uri(Constants.PathTimeTable_Day, UriKind.Relative);
|
||||
@@ -146,6 +190,10 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
page.NavigationService.Navigate(url);
|
||||
}
|
||||
|
||||
/// <summary> Raises the click today event. </summary>
|
||||
/// <remarks> Fiedler, 22.11.2013. </remarks>
|
||||
/// <param name="sender"> Source of the event. </param>
|
||||
/// <param name="e"> Event information to send to registered event handlers. </param>
|
||||
private void OnClickToday(object sender, EventArgs e)
|
||||
{
|
||||
DateTime firstDay = this.GetFirstDayOfWeek(DateTime.Now);
|
||||
@@ -183,6 +231,10 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Raises the click properties event. </summary>
|
||||
/// <remarks> Fiedler, 22.11.2013. </remarks>
|
||||
/// <param name="sender"> Source of the event. </param>
|
||||
/// <param name="e"> Event information to send to registered event handlers. </param>
|
||||
private void OnClickProperties(object sender, EventArgs e)
|
||||
{
|
||||
Uri url = new Uri(Constants.PathTimeTable_Properties, UriKind.Relative);
|
||||
@@ -190,6 +242,10 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
page.NavigationService.Navigate(url);
|
||||
}
|
||||
|
||||
/// <summary> Raises the click create event. </summary>
|
||||
/// <remarks> Fiedler, 22.11.2013. </remarks>
|
||||
/// <param name="sender"> Source of the event. </param>
|
||||
/// <param name="e"> Event information to send to registered event handlers. </param>
|
||||
private void OnClickCreate(object sender, EventArgs e)
|
||||
{
|
||||
TimeTable.Feed.Model.Appointments.CollectionChanged += new NotifyCollectionChangedEventHandler(this.OnListChanged);
|
||||
@@ -199,6 +255,10 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
page.NavigationService.Navigate(url);
|
||||
}
|
||||
|
||||
/// <summary> Raises the selection changed event. </summary>
|
||||
/// <remarks> Fiedler, 22.11.2013. </remarks>
|
||||
/// <param name="sender"> Source of the event. </param>
|
||||
/// <param name="e"> Event information to send to registered event handlers. </param>
|
||||
private void OnPivotSelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
int delta = this.ThePivot.SelectedIndex - this.lastSelectedIndex;
|
||||
@@ -225,6 +285,9 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
this.lastSelectedIndex = this.ThePivot.SelectedIndex;
|
||||
}
|
||||
|
||||
/// <summary> Executes the appointment click action. </summary>
|
||||
/// <remarks> Fiedler, 22.11.2013. </remarks>
|
||||
/// <param name="model"> The model. </param>
|
||||
private void OnAppointmentClick(AppointmentModel model)
|
||||
{
|
||||
int index = TimeTable.Feed.Model.Appointments.IndexOf(model);
|
||||
@@ -241,6 +304,10 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Raises the notify collection changed event. </summary>
|
||||
/// <remarks> Fiedler, 22.11.2013. </remarks>
|
||||
/// <param name="sender"> Source of the event. </param>
|
||||
/// <param name="e"> Event information to send to registered event handlers. </param>
|
||||
private void OnListChanged(object sender, NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
AppointmentModel tempModel = null;
|
||||
@@ -273,6 +340,12 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Check appointments. </summary>
|
||||
/// <remarks> Fiedler, 22.11.2013. </remarks>
|
||||
/// <exception cref="NullReferenceException">
|
||||
/// Thrown when a value was unexpectedly null.
|
||||
/// </exception>
|
||||
/// <param name="pageIndex"> (Optional) zero-based index of the page. </param>
|
||||
private void CheckAppointments(int pageIndex = -1)
|
||||
{
|
||||
if (TimeTable.Feed == null)
|
||||
|
||||
Reference in New Issue
Block a user