diff --git a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj
index ee755e20..525d8374 100644
--- a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj
+++ b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj
@@ -122,11 +122,16 @@
+
+
+ Appointment.xaml
+
+
TimeTableDay.xaml
@@ -434,6 +439,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
diff --git a/CampusAppWP8/CampusAppWP8/Model/TimeTable/AppointmentListModel.cs b/CampusAppWP8/CampusAppWP8/Model/TimeTable/AppointmentListModel.cs
new file mode 100644
index 00000000..559f31f0
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8/Model/TimeTable/AppointmentListModel.cs
@@ -0,0 +1,63 @@
+//-----------------------------------------------------------------------------
+//
+// Company copyright tag.
+//
+// fiedlchr
+// 26.08.2013
+//-----------------------------------------------------------------------------
+
+namespace CampusAppWP8.Model.TimeTable
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Collections.ObjectModel;
+ using System.Text.RegularExpressions;
+ using System.Windows.Shapes;
+ using System.Xml.Serialization;
+ using System.Windows.Controls;
+ using System.Windows.Media;
+ using System.Windows;
+ using CampusAppWP8.Utility;
+ using CampusAppWP8.Utility.ICSProperties;
+
+ ///
+ /// Model for appointments.
+ ///
+ [XmlRoot("root")]
+ public class AppointmentListModel
+ {
+ private ObservableCollection appointmentList;
+
+ /// Initializes a new instance of the class.
+ public AppointmentListModel()
+ {
+ this.appointmentList = new ObservableCollection();
+ }
+
+ // for testing
+ public AppointmentListModel(AppointmentModel[] appList) : this()
+ {
+ if (appList != null)
+ {
+ foreach (AppointmentModel a in appList)
+ {
+ this.appointmentList.Add(a);
+ }
+ }
+ }
+
+
+ public ObservableCollection Appointments
+ {
+ get
+ {
+ return this.appointmentList;
+ }
+
+ set
+ {
+ this.appointmentList = value;
+ }
+ }
+ }
+}
diff --git a/CampusAppWP8/CampusAppWP8/Model/TimeTable/AppointmentModel.cs b/CampusAppWP8/CampusAppWP8/Model/TimeTable/AppointmentModel.cs
index e1ab97b1..d31733cf 100644
--- a/CampusAppWP8/CampusAppWP8/Model/TimeTable/AppointmentModel.cs
+++ b/CampusAppWP8/CampusAppWP8/Model/TimeTable/AppointmentModel.cs
@@ -35,6 +35,9 @@ namespace CampusAppWP8.Model.TimeTable
private ICalObject icalObj = null;
+ public delegate void OnAppointmentClick(AppointmentModel sender);
+ public event OnAppointmentClick OnClick = null;
+
/// Initializes a new instance of the class.
public AppointmentModel()
{
@@ -167,7 +170,84 @@ namespace CampusAppWP8.Model.TimeTable
private void OnCanvasClick(object sender, EventArgs e)
{
-
+ if (this.OnClick != null)
+ {
+ this.OnClick(this);
+ }
+ }
+
+ // ------------------------------------------------------
+ public string Title
+ {
+ get
+ {
+ ICalObject eventICal = this.GetVEventObj();
+ Summary tempSum = eventICal.GetProperty(ICSTag.SUMMARY) as Summary;
+
+ return tempSum.Value;
+ }
+ }
+
+ public string Date
+ {
+ get
+ {
+ string retValue = string.Empty;
+
+ ICalObject eventICal = this.GetVEventObj();
+ DTStart startDT = eventICal.GetProperty(ICSTag.DT_START) as DTStart;
+ DTEnd endDT = eventICal.GetProperty(ICSTag.DT_END) as DTEnd;
+
+ if (startDT != null && endDT != null)
+ {
+ if (startDT.Value.Year.Equals(endDT.Value.Year) && startDT.Value.Month.Equals(endDT.Value.Month) && startDT.Value.Day.Equals(endDT.Value.Day))
+ {
+ retValue = string.Format("{0:d}, {0:HH:ss} - {1:HH:ss}", startDT.Value, endDT.Value);
+ }
+ else
+ {
+ retValue = string.Format("{0:d} {0:HH:ss} - {1:d} {1:HH:ss}", startDT.Value, endDT.Value);
+ }
+ }
+
+ return retValue;
+ }
+ }
+
+ public string Location
+ {
+ get
+ {
+ string retValue = string.Empty;
+
+ ICalObject eventICal = this.GetVEventObj();
+ Location loc = eventICal.GetProperty(ICSTag.LOCATION) as Location;
+
+ if (loc != null)
+ {
+ retValue = loc.Value;
+ }
+
+ return retValue;
+ }
+ }
+
+ public string Description
+ {
+ get
+ {
+ string retValue = string.Empty;
+
+ ICalObject eventICal = this.GetVEventObj();
+ Description desc = eventICal.GetProperty(ICSTag.DESCRIPTION) as Description;
+
+ if (desc != null)
+ {
+ retValue = desc.Value;
+ }
+
+ return retValue;
+ }
}
}
}
diff --git a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/Appointment.xaml b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/Appointment.xaml
new file mode 100644
index 00000000..5c4f1f52
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/Appointment.xaml
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/Appointment.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/Appointment.xaml.cs
new file mode 100644
index 00000000..9136c138
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/Appointment.xaml.cs
@@ -0,0 +1,84 @@
+//-----------------------------------------------------------------------------
+//
+// Company copyright tag.
+//
+// fiedlchr
+// 12.09.2013
+//-----------------------------------------------------------------------------
+namespace CampusAppWP8.Pages.TimeTable
+{
+ 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;
+ using CampusAppWP8.Resources;
+ using CampusAppWP8.Utility;
+
+ public partial class Appointment : PhoneApplicationPage
+ {
+ public Appointment()
+ {
+ this.InitializeComponent();
+
+ ApplicationBarIconButton editBtn = new ApplicationBarIconButton();
+ editBtn.IconUri = new Uri(Icons.Link, UriKind.Relative);
+ editBtn.Text = AppResources.Edit;
+ editBtn.Click += new EventHandler(this.OnClickEdit);
+ ApplicationBar.Buttons.Add(editBtn);
+
+ ApplicationBarIconButton deleteBtn = new ApplicationBarIconButton();
+ deleteBtn.IconUri = new Uri(Icons.TextToSpeech, UriKind.Relative);
+ deleteBtn.Text = AppResources.Delete;
+ deleteBtn.Click += new EventHandler(this.OnClickDelete);
+ ApplicationBar.Buttons.Add(deleteBtn);
+ }
+
+ protected override void OnNavigatedTo(NavigationEventArgs e)
+ {
+ base.OnNavigatedTo(e);
+
+
+ string appointmentIndex = string.Empty;
+
+ // Navigate to the selected pivotitem
+ if (NavigationContext.QueryString.TryGetValue(Constants.Param_Appointment_Index, out appointmentIndex))
+ {
+ int appointmentIndexInt = int.Parse(appointmentIndex);
+
+ // if the index is in the range of the array
+ if ((appointmentIndexInt >= 0) && (appointmentIndexInt < TimeTable.AppointmentsModel.Appointments.Count()))
+ {
+ this.DataContext = TimeTable.AppointmentsModel.Appointments[appointmentIndexInt];
+ }
+ else
+ {
+ string o = string.Empty;
+
+ foreach (KeyValuePair kvp in NavigationContext.QueryString)
+ {
+ o += string.Format("Key = {0}, Value = {1}", kvp.Key, kvp.Value) + "\n";
+ }
+
+ MessageBox.Show("ERROR: appointment index out of range!!! (" + o + ")");
+ }
+ }
+ }
+
+
+ private void OnClickEdit(object sender, EventArgs e)
+ {
+
+ }
+
+ private void OnClickDelete(object sender, EventArgs e)
+ {
+ TimeTable.AppointmentsModel.Appointments.Remove(this.DataContext as Model.TimeTable.AppointmentModel);
+ this.NavigationService.GoBack();
+ }
+ }
+}
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTable.cs b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTable.cs
new file mode 100644
index 00000000..da45486f
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTable.cs
@@ -0,0 +1,54 @@
+//-----------------------------------------------------------------------------
+//
+// Company copyright tag.
+//
+// fiedlchr
+// 12.09.2013
+//-----------------------------------------------------------------------------
+namespace CampusAppWP8.Pages.TimeTable
+{
+ 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;
+ using CampusAppWP8.Resources;
+ using CampusAppWP8.Utility;
+ using CampusAppWP8.Model.TimeTable;
+
+ public partial class TimeTable : PhoneApplicationPage
+ {
+ private static AppointmentListModel appList //= null;
+ = new AppointmentListModel(new AppointmentModel[] {
+ new AppointmentModel("BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:ownCloud Calendar 0.6.3\r\nX-WR-CALNAME:Das is der Titel\r\nBEGIN:VEVENT\r\nCREATED;VALUE=DATE-TIME:20130827T113216Z\r\nUID:c9904ea73c\r\nLAST-MODIFIED;VALUE=DATE-TIME:20130827T113216Z\r\nDTSTAMP;VALUE=DATE-TIME:20130827T113216Z\r\nSUMMARY:Das is der Titel\r\nDTSTART;VALUE=DATE-TIME:20130827T113500Z\r\nDTEND;VALUE=DATE-TIME:20130827T152000Z\r\nCLASS:PUBLIC\r\nLOCATION:BTU Campus\r\nDESCRIPTION:For Outlook 2003, the behavior is peculiar. It can save the sa\r\n me calendar entry in both .ics and .vcs format, but it only read & displa\r\n y .vcs file correctly. It can read .ics file but it omits some fields and \r\n does not display it in calendar mode. My guess is that back then Microsoft\r\n wanted to provide .ics to be compatible with Mac's iCal but not quite com\r\n mitted to v2.0 yet.\r\nCATEGORIES:Projekte\r\nEND:VEVENT\r\nEND:VCALENDAR"),
+ new AppointmentModel("BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:http://www.example.com/calendarapplication/\r\nMETHOD:PUBLISH\r\nBEGIN:VEVENT\r\nUID:461092315540@example.com\r\nORGANIZER:MAILTO:alice@example.com\r\nLOCATION:Somewhere\r\nSUMMARY:Eine Kurzinfo\r\nDESCRIPTION:Beschreibung des Termines\r\nCLASS:PUBLIC\r\nDTSTART:20060910T110000Z\r\nDTEND:20060910T195900Z\r\nDTSTAMP:20060812T125900Z\r\nEND:VEVENT\r\nEND:VCALENDAR"),
+ new AppointmentModel("BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:-//hacksw/handcal//NONSGML v1.0//EN\r\nBEGIN:VEVENT\r\nUID:uid1@example.com\r\nDTSTAMP:19970714T170000Z\r\nORGANIZER;CN=John Doe:MAILTO:john.doe@example.com\r\nDTSTART:19970714T170000Z\r\nDTEND:19970715T035959Z\r\nSUMMARY:Bastille Day Party\r\nEND:VEVENT\r\nEND:VCALENDAR"),
+ new AppointmentModel("BEGIN:VCALENDAR\r\nVERSION:1.0\r\nBEGIN:VEVENT\r\nCATEGORIES:MEETING\r\nSTATUS:TENTATIVE\r\nDTSTART:19960401T033000Z\r\nDTEND:19960401T043000Z\r\nSUMMARY:Your Proposal Review\r\nDESCRIPTION:Steve and John to review newest proposal material bla fsdfasfsdfsdfgsdafg sfdgfdsgf dsfg dsfgds fgds\r\nCLASS:PRIVATE\r\nEND:VEVENT\r\nEND:VCALENDAR"),
+ 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:20100701T080000Z\r\nDTEND:20100701T110000Z\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 TimeTable()
+ {
+ //this.InitializeComponent();
+
+ TimeTable.appList = new AppointmentListModel();
+ }
+
+ protected override void OnNavigatedTo(NavigationEventArgs e)
+ {
+ base.OnNavigatedTo(e);
+ }
+
+ public static AppointmentListModel AppointmentsModel
+ {
+ get
+ {
+ return TimeTable.appList;
+ }
+ }
+ }
+}
\ 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 18a17146..f3a653ba 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableDay.xaml.cs
+++ b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableDay.xaml.cs
@@ -11,6 +11,7 @@ using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using CampusAppWP8.Model.TimeTable;
using CampusAppWP8.Utility;
+using CampusAppWP8.Resources;
namespace CampusAppWP8.Pages.TimeTable
{
@@ -22,15 +23,11 @@ namespace CampusAppWP8.Pages.TimeTable
private readonly double DAY_TABLE_HEAD_THICKNESS = 2;
private readonly double DAY_TABLE_INNER_THICKNESS = 1;
- private AppointmentModel testMod = null;
- private AppointmentModel testMod2 = null;
private bool DayLayoutDone = false;
public TimeTableDay()
{
InitializeComponent();
- this.testMod = new AppointmentModel("BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:ownCloud Calendar 0.6.3\r\nX-WR-CALNAME:Das is der Titel\r\nBEGIN:VEVENT\r\nCREATED;VALUE=DATE-TIME:20130827T113216Z\r\nUID:c9904ea73c\r\nLAST-MODIFIED;VALUE=DATE-TIME:20130827T113216Z\r\nDTSTAMP;VALUE=DATE-TIME:20130827T113216Z\r\nSUMMARY:Das is der Titel\r\nDTSTART;VALUE=DATE-TIME:20130827T113500Z\r\nDTEND;VALUE=DATE-TIME:20130827T152000Z\r\nCLASS:PUBLIC\r\nLOCATION:BTU Campus\r\nDESCRIPTION:For Outlook 2003, the behavior is peculiar. It can save the sa\r\n me calendar entry in both .ics and .vcs format, but it only read & displa\r\n y .vcs file correctly. It can read .ics file but it omits some fields and \r\n does not display it in calendar mode. My guess is that back then Microsoft\r\n wanted to provide .ics to be compatible with Mac's iCal but not quite com\r\n mitted to v2.0 yet.\r\nCATEGORIES:Projekte\r\nEND:VEVENT\r\nEND:VCALENDAR");
- this.testMod2 = new AppointmentModel("BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:http://www.example.com/calendarapplication/\r\nMETHOD:PUBLISH\r\nBEGIN:VEVENT\r\nUID:461092315540@example.com\r\nORGANIZER:MAILTO:alice@example.com\r\nLOCATION:Somewhere\r\nSUMMARY:Eine Kurzinfo\r\nDESCRIPTION:Beschreibung des Termines\r\nCLASS:PUBLIC\r\nDTSTART:20060910T110000Z\r\nDTEND:20060910T195900Z\r\nDTSTAMP:20060812T125900Z\r\nEND:VEVENT\r\nEND:VCALENDAR");
this.DayScroll.LayoutUpdated += new EventHandler(this.AutoScrollToDay);
}
@@ -39,25 +36,46 @@ namespace CampusAppWP8.Pages.TimeTable
{
base.OnNavigatedTo(e);
- this.DrawDayViewBackground();
-
- double maxW = Application.Current.Host.Content.ActualWidth;
-
- maxW -= (DAY_TABLE_HEAD_WIDTH + 6.0);
-
+ if (e.NavigationMode != NavigationMode.Back)
{
- Canvas temp = this.testMod.GetCanvas();
- temp.Margin = new Thickness(DAY_TABLE_HEAD_WIDTH + 2, this.testMod.GetYOffset, 0, 0);
- this.DayView.Children.Add(temp);
+ this.DrawDayViewBackground();
- temp = this.testMod2.GetCanvas();
- temp.Margin = new Thickness(DAY_TABLE_HEAD_WIDTH + 2 + 2 + (maxW / 2), this.testMod2.GetYOffset, 0, 0);
- this.DayView.Children.Add(temp);
+ double maxW = Application.Current.Host.Content.ActualWidth;
+
+ maxW -= (DAY_TABLE_HEAD_WIDTH + 6.0);
+
+ List tempList = TimeTable.AppointmentsModel.Appointments.ToList();
+
+ for (int i = 0; i < tempList.Count(); i++)
+ {
+ tempList[i].OnClick += new AppointmentModel.OnAppointmentClick(this.EventOnAppointmentClick);
+ Canvas temp = tempList[i].GetCanvas();
+ temp.Margin = new Thickness(DAY_TABLE_HEAD_WIDTH + 2, tempList[i].GetYOffset, 0, 0);
+ this.DayView.Children.Add(temp);
+
+ /*
+ temp = this.testMod2.GetCanvas();
+ temp.Margin = new Thickness(DAY_TABLE_HEAD_WIDTH + 2 + 2 + (maxW / 2), this.testMod2.GetYOffset, 0, 0);
+ this.DayView.Children.Add(temp);
+ */
+ }
}
-
this.DayLayoutDone = true;
}
+ private void EventOnAppointmentClick(AppointmentModel sender)
+ {
+ int index = TimeTable.AppointmentsModel.Appointments.IndexOf(sender);
+
+ if (index >= 0)
+ {
+ string urlString = "/Pages/TimeTable/Appointment.xaml?" + Constants.Param_Appointment_Index + "=" + index;
+
+ Uri url = new Uri(urlString, UriKind.Relative);
+ Page page = App.RootFrame.Content as Page;
+ page.NavigationService.Navigate(url);
+ }
+ }
private void AutoScrollToDay(object sender, EventArgs e)
{
diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs
index 9cb9bff8..61657fb9 100644
--- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs
+++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs
@@ -96,6 +96,15 @@ namespace CampusAppWP8.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die Termin ähnelt.
+ ///
+ public static string Appointment {
+ get {
+ return ResourceManager.GetString("Appointment", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die Gebäude ähnelt.
///
@@ -213,6 +222,15 @@ namespace CampusAppWP8.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die Bearbeiten ähnelt.
+ ///
+ public static string Edit {
+ get {
+ return ResourceManager.GetString("Edit", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die Events ähnelt.
///
diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx
index 72626477..ef7e888e 100644
--- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx
+++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx
@@ -431,4 +431,10 @@
Personen
+
+ Termin
+
+
+ Bearbeiten
+
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs
index d4c18d60..f3192aca 100644
--- a/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs
+++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs
@@ -492,6 +492,15 @@ namespace CampusAppWP8.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die AppointmentIndex ähnelt.
+ ///
+ public static string Param_Appointment_Index {
+ get {
+ return ResourceManager.GetString("Param_Appointment_Index", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die Studiengang ähnelt.
///
diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx
index ef787291..6e07b8c8 100644
--- a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx
+++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx
@@ -459,4 +459,7 @@
035569
+
+ AppointmentIndex
+
\ No newline at end of file