diff --git a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj
index 2748d227..9be602ad 100644
--- a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj
+++ b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj
@@ -102,6 +102,7 @@
App.xaml
+
diff --git a/CampusAppWP8/CampusAppWP8/Feed/TimeTable/AppointmentFeed.cs b/CampusAppWP8/CampusAppWP8/Feed/TimeTable/AppointmentFeed.cs
new file mode 100644
index 00000000..e72ab883
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8/Feed/TimeTable/AppointmentFeed.cs
@@ -0,0 +1,111 @@
+
+namespace CampusAppWP8.Feed.TimeTable
+{
+ using System;
+ using System.Collections.Generic;
+ using System.IO;
+ using System.Text;
+ using System.Text.RegularExpressions;
+ using CampusAppWP8.Model;
+ using CampusAppWP8.Resources;
+ using CampusAppWP8.Utility;
+ using CampusAppWP8.Model.TimeTable;
+ using CampusAppWPortalLib8.Model;
+
+ public class AppointmentFeed : XmlModel
+ {
+
+ public AppointmentFeed(bool autoLoad = true)
+ : base(ModelType.File, Constants.FileAppointments_Name)
+ {
+ this.IsFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDateOnLoad);
+ this.IsFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDateOnSave);
+ this.IsModelUpToDateOnLoad += new IsModelUpToDate(this.CheckIsModelUpToDate);
+
+ if (autoLoad == true)
+ {
+ this.LoadData();
+ }
+ }
+
+ private bool CheckIsModelUpToDate(AppointmentListModel model)
+ {
+ bool retValue = true;
+
+ if (model == null)
+ {
+ retValue = false;
+ }
+
+ return retValue;
+ }
+
+ private bool CheckIsFileUpToDateOnLoad(AppointmentListModel model, FileInfo info)
+ {
+ bool retValue = true;
+
+ return retValue;
+ }
+
+ private bool CheckIsFileUpToDateOnSave(AppointmentListModel model, FileInfo info)
+ {
+ bool retValue = true;
+
+ if ((info == null)
+ || (info.Exists == false)
+ || (info.Length == 0))
+ {
+ retValue = false;
+ }
+
+ if (model != null && model.HasChanged(true))
+ {
+ retValue = false;
+ }
+
+ return retValue;
+ }
+
+ protected override bool DeserializeModel(byte[] modelData)
+ {
+ if (this.Model == null)
+ {
+ this.Model = new AppointmentListModel();
+ }
+
+ string temp = Encoding.UTF8.GetString(modelData, 0, modelData.Length);
+ string[] appStr = Regex.Split(temp, "");
+
+ for (int i = 0; i < appStr.Length; i++)
+ {
+ if (appStr.Length > 0)
+ {
+ appStr[i] = appStr[i].Replace("", string.Empty);
+
+ AppointmentModel newAppModel = new AppointmentModel(appStr[i]);
+
+ this.Model.Appointments.Add(newAppModel);
+ }
+ }
+
+ return true;
+ }
+
+ protected override byte[] SerializeModel()
+ {
+ List retValue = new List();
+
+ if (this.Model != null)
+ {
+ for (int i = 0; i < this.Model.Appointments.Count; i++)
+ {
+ retValue.AddRange(Encoding.UTF8.GetBytes(""));
+ retValue.AddRange(ICSManager.ExportToICSByte(this.Model.Appointments[i].CalendarObj));
+ retValue.AddRange(Encoding.UTF8.GetBytes(""));
+ }
+ }
+
+ return retValue.ToArray();
+ }
+ }
+}
diff --git a/CampusAppWP8/CampusAppWP8/Model/TimeTable/AppointmentListModel.cs b/CampusAppWP8/CampusAppWP8/Model/TimeTable/AppointmentListModel.cs
index 19feec4c..34db3d0d 100644
--- a/CampusAppWP8/CampusAppWP8/Model/TimeTable/AppointmentListModel.cs
+++ b/CampusAppWP8/CampusAppWP8/Model/TimeTable/AppointmentListModel.cs
@@ -24,17 +24,17 @@ namespace CampusAppWP8.Model.TimeTable
///
/// Model for appointments.
///
- [XmlRoot("root")]
public class AppointmentListModel
{
private ObservableCollection appointmentList;
private int hasChangedIndex = -1;
+ private bool hasChanged = false;
/// Initializes a new instance of the class.
public AppointmentListModel()
{
this.appointmentList = new ObservableCollection();
- this.appointmentList.CollectionChanged += new NotifyCollectionChangedEventHandler(this.OnCollectionChanged);
+ this.appointmentList.CollectionChanged += this.OnCollectionChanged;
}
// for testing
@@ -50,7 +50,6 @@ namespace CampusAppWP8.Model.TimeTable
}
}
-
public ObservableCollection Appointments
{
get
@@ -60,7 +59,17 @@ namespace CampusAppWP8.Model.TimeTable
set
{
+ if(this.appointmentList != null)
+ {
+ this.appointmentList.CollectionChanged -= this.OnCollectionChanged;
+ }
+
this.appointmentList = value;
+
+ if(this.appointmentList != null)
+ {
+ this.appointmentList.CollectionChanged += this.OnCollectionChanged;
+ }
}
}
@@ -74,12 +83,28 @@ namespace CampusAppWP8.Model.TimeTable
}
}
+ public bool HasChanged(bool reset = false)
+ {
+ bool retValue = false;
+
+ retValue = this.hasChanged;
+
+ if(reset == true)
+ {
+ this.hasChanged = false;
+ }
+
+ return retValue;
+ }
+
private void OnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
if (e.Action == NotifyCollectionChangedAction.Add)
{
this.hasChangedIndex = e.NewStartingIndex;
}
+
+ this.hasChanged = true;
}
}
}
diff --git a/CampusAppWP8/CampusAppWP8/Model/TimeTable/AppointmentModel.cs b/CampusAppWP8/CampusAppWP8/Model/TimeTable/AppointmentModel.cs
index f205729f..3ca3ad88 100644
--- a/CampusAppWP8/CampusAppWP8/Model/TimeTable/AppointmentModel.cs
+++ b/CampusAppWP8/CampusAppWP8/Model/TimeTable/AppointmentModel.cs
@@ -22,7 +22,6 @@ namespace CampusAppWP8.Model.TimeTable
///
/// Model for appointments.
///
- [XmlRoot("root")]
public class AppointmentModel
{
private ICalObject icalObj = null;
@@ -52,6 +51,19 @@ namespace CampusAppWP8.Model.TimeTable
this.icalObj = ICSManager.ImportFromICS(icsData);
}
+ public ICalObject CalendarObj
+ {
+ get
+ {
+ return this.icalObj;
+ }
+
+ set
+ {
+ this.icalObj = value;
+ }
+ }
+
public int IsDate(DateTime date, int daySpan = 0)
{
int retValue = -1;
diff --git a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/Appointment.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/Appointment.xaml.cs
index 156c2612..2fb521e9 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/Appointment.xaml.cs
+++ b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/Appointment.xaml.cs
@@ -48,7 +48,7 @@ namespace CampusAppWP8.Pages.TimeTable
if (e.NavigationMode == NavigationMode.Back)
{
- TimeTable.AppointmentsModel.Appointments.CollectionChanged -= this.OnListChanged;
+ TimeTable.Feed.Model.Appointments.CollectionChanged -= this.OnListChanged;
this.DataContext = this.appModel;
}
else
@@ -61,10 +61,10 @@ namespace CampusAppWP8.Pages.TimeTable
int appointmentIndex = int.Parse(appointmentIndexStr);
// if the index is in the range of the array
- if ((appointmentIndex >= 0) && (appointmentIndex < TimeTable.AppointmentsModel.Appointments.Count()))
+ if ((appointmentIndex >= 0) && (appointmentIndex < TimeTable.Feed.Model.Appointments.Count()))
{
- this.appModel = TimeTable.AppointmentsModel.Appointments[appointmentIndex];
- this.DataContext = TimeTable.AppointmentsModel.Appointments[appointmentIndex];
+ this.appModel = TimeTable.Feed.Model.Appointments[appointmentIndex];
+ this.DataContext = TimeTable.Feed.Model.Appointments[appointmentIndex];
}
else
{
@@ -93,9 +93,9 @@ namespace CampusAppWP8.Pages.TimeTable
{
if (this.appModel != null)
{
- TimeTable.AppointmentsModel.Appointments.CollectionChanged += new NotifyCollectionChangedEventHandler(this.OnListChanged);
+ TimeTable.Feed.Model.Appointments.CollectionChanged += new NotifyCollectionChangedEventHandler(this.OnListChanged);
- string urlString = "/Pages/TimeTable/AppointmentEdit.xaml?" + Constants.Param_Appointment_Index + "=" + TimeTable.AppointmentsModel.Appointments.IndexOf(this.appModel);
+ string urlString = "/Pages/TimeTable/AppointmentEdit.xaml?" + Constants.Param_Appointment_Index + "=" + TimeTable.Feed.Model.Appointments.IndexOf(this.appModel);
Uri url = new Uri(urlString, UriKind.Relative);
Page page = App.RootFrame.Content as Page;
@@ -105,7 +105,7 @@ namespace CampusAppWP8.Pages.TimeTable
private void OnClickDelete(object sender, EventArgs e)
{
- TimeTable.AppointmentsModel.Appointments.Remove(this.appModel);
+ TimeTable.Feed.Model.Appointments.Remove(this.appModel);
this.NavigationService.GoBack();
}
}
diff --git a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/AppointmentEdit.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/AppointmentEdit.xaml.cs
index 47452724..ec213f5b 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/AppointmentEdit.xaml.cs
+++ b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/AppointmentEdit.xaml.cs
@@ -68,11 +68,11 @@ namespace CampusAppWP8.Pages.TimeTable
this.appointmentIndex = int.Parse(appointmentIndexStr);
// if the index is in the range of the array
- if ((this.appointmentIndex >= 0) && (this.appointmentIndex < TimeTable.AppointmentsModel.Appointments.Count()))
+ if ((this.appointmentIndex >= 0) && (this.appointmentIndex < TimeTable.Feed.Model.Appointments.Count()))
{
this.HeadLine.Text = AppResources.Edit;
//this.DataContext = TimeTable.AppointmentsModel.Appointments[this.appointmentIndex];
- AppointmentModel tempModel = TimeTable.AppointmentsModel.Appointments[this.appointmentIndex];
+ AppointmentModel tempModel = TimeTable.Feed.Model.Appointments[this.appointmentIndex];
this.InTitle.Text = tempModel.Title;
this.InLocation.Text = tempModel.Location;
@@ -230,10 +230,10 @@ namespace CampusAppWP8.Pages.TimeTable
if (this.appointmentIndex >= 0)
{
- TimeTable.AppointmentsModel.Appointments.RemoveAt(this.appointmentIndex);
+ TimeTable.Feed.Model.Appointments.RemoveAt(this.appointmentIndex);
}
- TimeTable.AppointmentsModel.Appointments.Add(newItem);
+ TimeTable.Feed.Model.Appointments.Add(newItem);
Page page = App.RootFrame.Content as Page;
page.NavigationService.GoBack();
diff --git a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTable.cs b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTable.cs
index 85ce3f26..977bd6c2 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTable.cs
+++ b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTable.cs
@@ -12,6 +12,7 @@ namespace CampusAppWP8.Pages.TimeTable
using System.Linq;
using System.Net;
using System.Windows;
+ using System.Windows.Media;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
@@ -19,6 +20,7 @@ namespace CampusAppWP8.Pages.TimeTable
using CampusAppWP8.Resources;
using CampusAppWP8.Utility;
using CampusAppWP8.Model.TimeTable;
+ using CampusAppWP8.Feed.TimeTable;
public partial class TimeTable : PhoneApplicationPage
{
@@ -32,21 +34,57 @@ 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:20130914T120000Z\r\nDTEND:20130914T140000Z\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 static int VisualScale = 0; //0 - small, 1 - medium, 2 - large
+ public static int Setting_AutoScrollToHour = 7;
+ public static int Setting_VisualScale = 0; //0 - small, 1 - medium, 2 - large UNUSED ATM
+ public static double Setting_Hour_Spacing = 40;
+ public static double Setting_View_Height = Setting_Hour_Spacing * 24;
+ public static int Setting_Max_Z_Index = 10;
+ public static double Setting_Z_Spacing = 10;
+ public static SolidColorBrush[] Setting_Priority_Colors = new SolidColorBrush[]
+ {
+ new SolidColorBrush(Colors.Green),
+ new SolidColorBrush(Colors.Orange),
+ new SolidColorBrush(Colors.Blue),
+ new SolidColorBrush(Colors.Brown),
+ new SolidColorBrush(Colors.Cyan),
+ new SolidColorBrush(Colors.DarkGray),
+ new SolidColorBrush(Colors.Magenta),
+ new SolidColorBrush(Colors.Purple),
+ new SolidColorBrush(Colors.Yellow),
+ new SolidColorBrush(Colors.Red)
+ };
- public TimeTable()
- {
- //this.InitializeComponent();
- TimeTable.appList = new AppointmentListModel();
- }
+ private static AppointmentFeed feed = null;
- public static AppointmentListModel AppointmentsModel
+ public static AppointmentFeed Feed
{
get
{
- return TimeTable.appList;
+ if (TimeTable.feed == null)
+ {
+ throw new NullReferenceException();
+ }
+
+ return TimeTable.feed;
+ }
+ }
+
+ public static void InitFeed()
+ {
+ if(TimeTable.feed == null)
+ {
+ TimeTable.feed = new AppointmentFeed(false);
+ TimeTable.feed.OnFailedFile += new CampusAppWPortalLib8.Model.AbstractMainModel.OnFailed(TimeTable.OnLoadFailed);
+ TimeTable.feed.LoadData();
+ }
+ }
+
+ private static void OnLoadFailed()
+ {
+ if (TimeTable.feed.Model == null)
+ {
+ TimeTable.feed.Model = new AppointmentListModel();
}
}
}
diff --git a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableDay.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableDay.xaml.cs
index 43226ae6..c6db0614 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableDay.xaml.cs
+++ b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableDay.xaml.cs
@@ -92,7 +92,7 @@ namespace CampusAppWP8.Pages.TimeTable
if (e.NavigationMode == NavigationMode.Back)
{
- TimeTable.AppointmentsModel.Appointments.CollectionChanged -= this.OnListChanged;
+ TimeTable.Feed.Model.Appointments.CollectionChanged -= this.OnListChanged;
}
else
{
@@ -136,11 +136,11 @@ namespace CampusAppWP8.Pages.TimeTable
private void OnAppointmentClick(object sender, System.Windows.Input.GestureEventArgs e)
{
- int index = TimeTable.AppointmentsModel.Appointments.IndexOf((sender as Canvas).Tag as AppointmentModel);
+ int index = TimeTable.Feed.Model.Appointments.IndexOf((sender as Canvas).Tag as AppointmentModel);
if (index >= 0)
{
- TimeTable.AppointmentsModel.Appointments.CollectionChanged += new NotifyCollectionChangedEventHandler(this.OnListChanged);
+ TimeTable.Feed.Model.Appointments.CollectionChanged += new NotifyCollectionChangedEventHandler(this.OnListChanged);
string urlString = "/Pages/TimeTable/Appointment.xaml?" + Constants.Param_Appointment_Index + "=" + index;
@@ -190,7 +190,7 @@ namespace CampusAppWP8.Pages.TimeTable
{
if ((sender as ScrollViewer).VerticalOffset == 0.0)
{
- (sender as ScrollViewer).ScrollToVerticalOffset(DAY_TABLE_CELL_HEIGHT * TimeTable.AutoScrollToHour);
+ (sender as ScrollViewer).ScrollToVerticalOffset(DAY_TABLE_CELL_HEIGHT * TimeTable.Setting_AutoScrollToHour);
}
}
@@ -223,7 +223,7 @@ namespace CampusAppWP8.Pages.TimeTable
private void OnClickAdd(object sender, EventArgs e)
{
- TimeTable.AppointmentsModel.Appointments.CollectionChanged += new NotifyCollectionChangedEventHandler(this.OnListChanged);
+ TimeTable.Feed.Model.Appointments.CollectionChanged += new NotifyCollectionChangedEventHandler(this.OnListChanged);
Uri url = new Uri("/Pages/TimeTable/AppointmentEdit.xaml", UriKind.Relative);
Page page = App.RootFrame.Content as Page;
@@ -306,13 +306,13 @@ namespace CampusAppWP8.Pages.TimeTable
this.itemPages[index].Stacks.Clear();
this.itemPages[index].Content.Children.Clear();
- for (int i = 0; i < TimeTable.AppointmentsModel.Appointments.Count(); i++)
+ for (int i = 0; i < TimeTable.Feed.Model.Appointments.Count(); i++)
{
int appointmentIndex = -1;
- if ((appointmentIndex = TimeTable.AppointmentsModel.Appointments[i].IsDate(this.itemPages[index].Date)) > -1)
+ if ((appointmentIndex = TimeTable.Feed.Model.Appointments[i].IsDate(this.itemPages[index].Date)) > -1)
{
- tempList.Add(TimeTable.AppointmentsModel.Appointments[i]);
+ tempList.Add(TimeTable.Feed.Model.Appointments[i]);
}
}
// -------------------------------------------------------------
diff --git a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableProperties.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableProperties.xaml.cs
index 455f5c20..706e6fa0 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableProperties.xaml.cs
+++ b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableProperties.xaml.cs
@@ -35,19 +35,19 @@ namespace CampusAppWP8.Pages.TimeTable
}
this.AutoScroll.ItemsSource = tempAutoScroll;
- this.AutoScroll.SelectedIndex = TimeTable.AutoScrollToHour;
+ this.AutoScroll.SelectedIndex = TimeTable.Setting_AutoScrollToHour;
// VisualSize
this.VisualScale.ItemsSource = VisualScaleText;
- this.VisualScale.SelectedIndex = TimeTable.VisualScale;
+ this.VisualScale.SelectedIndex = TimeTable.Setting_VisualScale;
}
protected override void OnNavigatedFrom(NavigationEventArgs e)
{
base.OnNavigatedFrom(e);
- TimeTable.AutoScrollToHour = this.AutoScroll.SelectedIndex;
- TimeTable.VisualScale = this.VisualScale.SelectedIndex;
+ TimeTable.Setting_AutoScrollToHour = this.AutoScroll.SelectedIndex;
+ TimeTable.Setting_VisualScale = this.VisualScale.SelectedIndex;
}
}
}
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableWeek.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableWeek.xaml.cs
index bf3825d3..993ca036 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableWeek.xaml.cs
+++ b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableWeek.xaml.cs
@@ -41,6 +41,8 @@ namespace CampusAppWP8.Pages.TimeTable
{
this.InitializeComponent();
+ TimeTable.InitFeed();
+
DateTime firstDay = this.GetFirstDayOfWeek(DateTime.Now).AddDays(-7 * PIVOT_PAGES_HALF_DOWN);
for (int i = 0; i < PIVOT_PAGES; i++)
@@ -86,7 +88,7 @@ namespace CampusAppWP8.Pages.TimeTable
if (e.NavigationMode == NavigationMode.Back)
{
- TimeTable.AppointmentsModel.Appointments.CollectionChanged -= this.OnListChanged;
+ TimeTable.Feed.Model.Appointments.CollectionChanged -= this.OnListChanged;
}
else
{
@@ -98,6 +100,13 @@ namespace CampusAppWP8.Pages.TimeTable
}
}
+ protected override void OnNavigatedFrom(NavigationEventArgs e)
+ {
+ base.OnNavigatedFrom(e);
+
+ TimeTable.Feed.SaveData();
+ }
+
private DateTime GetFirstDayOfWeek(DateTime dayInWeek)
{
DateTime retValue = dayInWeek.Date;
@@ -146,7 +155,7 @@ namespace CampusAppWP8.Pages.TimeTable
page.NavigationService.Navigate(url);
*/
// this.itemPages[this.ThePivot.SelectedIndex].weekView.SetColumnBackground(0, new SolidColorBrush(Colors.Red));
- (this.ThePivot.SelectedItem as WeekViewPageItem).AppointmentList.Add(TimeTable.AppointmentsModel.Appointments[1]);
+ (this.ThePivot.SelectedItem as WeekViewPageItem).AppointmentList.Add(TimeTable.Feed.Model.Appointments[1]);
}
private void OnClickToday(object sender, EventArgs e)
@@ -179,7 +188,7 @@ namespace CampusAppWP8.Pages.TimeTable
private void OnClickCreate(object sender, EventArgs e)
{
- TimeTable.AppointmentsModel.Appointments.CollectionChanged += new NotifyCollectionChangedEventHandler(this.OnListChanged);
+ TimeTable.Feed.Model.Appointments.CollectionChanged += new NotifyCollectionChangedEventHandler(this.OnListChanged);
Uri url = new Uri(Constants.PathTimeTable_AppointmentEdit, UriKind.Relative);
Page page = App.RootFrame.Content as Page;
@@ -216,7 +225,7 @@ namespace CampusAppWP8.Pages.TimeTable
this.lastSelectedIndex = this.ThePivot.SelectedIndex;
}
-
+/*
private void OnAutoScroll(object sender, RoutedEventArgs e)
{
if ((sender as ScrollViewer).VerticalOffset == 0.0)
@@ -224,14 +233,14 @@ namespace CampusAppWP8.Pages.TimeTable
(sender as ScrollViewer).ScrollToVerticalOffset(WEEK_TABLE_CELL_HEIGHT * TimeTable.AutoScrollToHour);
}
}
-
+*/
private void OnAppointmentClick(AppointmentModel model)
{
- int index = TimeTable.AppointmentsModel.Appointments.IndexOf(model);
+ int index = TimeTable.Feed.Model.Appointments.IndexOf(model);
if (index >= 0)
{
- TimeTable.AppointmentsModel.Appointments.CollectionChanged += new NotifyCollectionChangedEventHandler(this.OnListChanged);
+ TimeTable.Feed.Model.Appointments.CollectionChanged += new NotifyCollectionChangedEventHandler(this.OnListChanged);
string urlString = Constants.PathTimeTable_Appointment + "?" + Constants.Param_Appointment_Index + "=" + index;
@@ -319,6 +328,8 @@ namespace CampusAppWP8.Pages.TimeTable
this.itemList[i].AppointmentList.Add(tempModel);
}
}
+
+ TimeTable.Feed.SaveData(true);
}
else if (e.Action == NotifyCollectionChangedAction.Remove)
{
@@ -337,14 +348,29 @@ namespace CampusAppWP8.Pages.TimeTable
private void CheckAppointments()
{
- foreach (AppointmentModel m in TimeTable.AppointmentsModel.Appointments)
+ if (TimeTable.Feed == null)
{
+ throw new NullReferenceException("feed == null");
+ }
+ else if (TimeTable.Feed.Model == null)
+ {
+ throw new NullReferenceException("model == null");
+ }
+ else if (TimeTable.Feed.Model.Appointments == null)
+ {
+ throw new NullReferenceException("Appointments == null");
+ }
+
+ for (int m = 0; m < TimeTable.Feed.Model.Appointments.Count; m++)
+ {
+ AppointmentModel temp = TimeTable.Feed.Model.Appointments[m];
+
for (int i = 0; i < PIVOT_PAGES; i++)
{
- if (m.IsDate(this.itemList[i].FromDT, 4) >= 0)
+ if (temp.IsDate(this.itemList[i].FromDT, 4) >= 0)
{
- m.OnClick += this.OnAppointmentClick;
- this.itemList[i].AppointmentList.Add(m);
+ temp.OnClick += this.OnAppointmentClick;
+ this.itemList[i].AppointmentList.Add(temp);
}
}
}
@@ -379,7 +405,7 @@ namespace CampusAppWP8.Pages.TimeTable
tempList[i] = new List();
}
*/
- for (int i = 0; i < TimeTable.AppointmentsModel.Appointments.Count(); i++)
+ for (int i = 0; i < TimeTable.Feed.Model.Appointments.Count(); i++)
{
/*
for (int k = 0; k < 5; k++)
@@ -390,9 +416,9 @@ namespace CampusAppWP8.Pages.TimeTable
}
}
*/
- if (TimeTable.AppointmentsModel.Appointments[i].IsDate(this.itemList[index].FromDT.Date, 4) > -1)
+ if (TimeTable.Feed.Model.Appointments[i].IsDate(this.itemList[index].FromDT.Date, 4) > -1)
{
- tempList.Add(TimeTable.AppointmentsModel.Appointments[i]);
+ tempList.Add(TimeTable.Feed.Model.Appointments[i]);
}
}
// -------------------------------------------------------
diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx
index 1e7fbdef..7db93ad9 100644
--- a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx
+++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx
@@ -594,4 +594,7 @@
CurrentPositionPoint
+
+ Appointments.xaml
+
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs
index 4aec5b6e..7e7836cf 100644
--- a/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs
+++ b/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs
@@ -249,6 +249,15 @@ namespace CampusAppWP8.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die Appointments.xaml ähnelt.
+ ///
+ public static string FileAppointments_Name {
+ get {
+ return ResourceManager.GetString("FileAppointments_Name", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die DepartmentFavoriteFeed.xml ähnelt.
///
diff --git a/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/AppointmentCanvas.xaml.cs b/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/AppointmentCanvas.xaml.cs
index 577c0ad2..6c897d5b 100644
--- a/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/AppointmentCanvas.xaml.cs
+++ b/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/AppointmentCanvas.xaml.cs
@@ -18,29 +18,12 @@ namespace CampusAppWP8.Utility.Lui.Templates
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using CampusAppWP8.Model.TimeTable;
+ using CampusAppWP8.Pages.TimeTable;
using System.Windows.Data;
using System.Windows.Media;
public partial class AppointmentCanvas : UserControl
{
- private static readonly double HOURS_SPACING = 40;
- private static readonly double INDEX_SPACING = 10;
- private static readonly int TOP_Z_INDEX = 10;
-
- private static readonly SolidColorBrush[] PRIO_COLORS = new SolidColorBrush[]
- {
- new SolidColorBrush(Colors.Green),
- new SolidColorBrush(Colors.Orange),
- new SolidColorBrush(Colors.Blue),
- new SolidColorBrush(Colors.Brown),
- new SolidColorBrush(Colors.Cyan),
- new SolidColorBrush(Colors.DarkGray),
- new SolidColorBrush(Colors.Magenta),
- new SolidColorBrush(Colors.Purple),
- new SolidColorBrush(Colors.Yellow),
- new SolidColorBrush(Colors.Red)
- };
-
private AppointmentModel appPtr = null;
public AppointmentCanvas() : base()
@@ -58,9 +41,9 @@ namespace CampusAppWP8.Utility.Lui.Templates
double totalHours = model.GetTotalHours(day);
- this.Height = ((totalHours < 0.25) ? 0.25 : totalHours) * HOURS_SPACING;
+ this.Height = ((totalHours < 0.25) ? 0.25 : totalHours) * TimeTable.Setting_Hour_Spacing;
this.SetText(model.Title);
- this.SetValue(Canvas.TopProperty, (day.Date.Equals(model.Start.Date)) ? (model.Start.TimeOfDay.TotalHours * HOURS_SPACING) : 0);
+ this.SetValue(Canvas.TopProperty, (day.Date.Equals(model.Start.Date)) ? (model.Start.TimeOfDay.TotalHours * TimeTable.Setting_Hour_Spacing) : 0);
object tempProp = null;
@@ -82,12 +65,12 @@ namespace CampusAppWP8.Utility.Lui.Templates
public void SetListPosition(int index, int count)
{
this.Margin = new Thickness(
- (INDEX_SPACING * index),
+ (TimeTable.Setting_Z_Spacing * index),
0,
- (INDEX_SPACING * (count - 1)),
+ (TimeTable.Setting_Z_Spacing * (count - 1)),
0);
- this.SetValue(Canvas.ZIndexProperty, ((TOP_Z_INDEX - index) < 0) ? 0 : (TOP_Z_INDEX - index));
+ this.SetValue(Canvas.ZIndexProperty, ((TimeTable.Setting_Max_Z_Index - index) < 0) ? 0 : (TimeTable.Setting_Max_Z_Index - index));
if (index == 0)
{
@@ -120,12 +103,12 @@ namespace CampusAppWP8.Utility.Lui.Templates
private void SetText(string text)
{
- if (this.Height < (HOURS_SPACING * 0.5))
+ if (this.Height < (TimeTable.Setting_Hour_Spacing * 0.5))
{
this.TheText.Text = "...";
this.TheText.Margin = new Thickness(
0,
- this.Height - (HOURS_SPACING * 0.5),
+ this.Height - (TimeTable.Setting_Hour_Spacing * 0.5),
0,
0);
}
@@ -137,9 +120,9 @@ namespace CampusAppWP8.Utility.Lui.Templates
private void SetBGColorByPriority(int prio)
{
- if (prio < PRIO_COLORS.Count() && prio >= 0)
+ if (prio < TimeTable.Setting_Priority_Colors.Count() && prio >= 0)
{
- this.TheRect.Fill = PRIO_COLORS[prio];
+ this.TheRect.Fill = TimeTable.Setting_Priority_Colors[prio];
}
}
}
diff --git a/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekView.xaml b/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekView.xaml
index 494fa87f..3b9c5896 100644
--- a/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekView.xaml
+++ b/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekView.xaml
@@ -67,66 +67,66 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekView.xaml.cs b/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekView.xaml.cs
index b9b117da..3c7cb3f2 100644
--- a/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekView.xaml.cs
+++ b/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekView.xaml.cs
@@ -20,6 +20,7 @@ namespace CampusAppWP8.Utility.Lui.Templates
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using CampusAppWP8.Model.TimeTable;
+ using CampusAppWP8.Pages.TimeTable;
public partial class WeekView : UserControl
@@ -232,7 +233,7 @@ namespace CampusAppWP8.Utility.Lui.Templates
private void AutoScroll(object sender, RoutedEventArgs e)
{
- this.TheScrollView.ScrollToVerticalOffset((40 * 7) + 2);
+ this.TheScrollView.ScrollToVerticalOffset((TimeTable.Setting_Hour_Spacing * 7) + 2);
}
}
}
diff --git a/CampusAppWP8/CampusAppWPortalLib8/Model/Departments/DepartmentModel.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/Departments/DepartmentModel.cs
index 947a52c4..f86a9159 100644
--- a/CampusAppWP8/CampusAppWPortalLib8/Model/Departments/DepartmentModel.cs
+++ b/CampusAppWP8/CampusAppWPortalLib8/Model/Departments/DepartmentModel.cs
@@ -106,7 +106,7 @@ namespace CampusAppWPortalLib8.Model.Departments
foreach (FacultyModel temp in this.Faculties)
{
- if ((temp.HasChanged() == true) && (retValue == false))
+ if (temp.HasChanged() == true)
{
retValue = true;
}