diff --git a/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml.cs
index 8f9829bb..a764eb2f 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml.cs
+++ b/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml.cs
@@ -10,15 +10,19 @@ namespace CampusAppWP8.Pages.Events
{
using System;
using System.Collections.Generic;
+ using System.Globalization;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
- using Windows.Phone.Speech.Synthesis;
+ using CampusAppWP8.Model.TimeTable;
using CampusAppWP8.Resources;
+ using CampusAppWP8.Utility;
+ using CampusAppWP8.Utility.ICSProperties;
using CampusAppWP8.Utility.Lui.Page;
using CampusAppWPortalLib8.Model.RSS;
using Microsoft.Phone.Shell;
+ using Windows.Phone.Speech.Synthesis;
/// EventPage, where every event feed has his own PivotItem.
/// Stubbfel, 22.10.2013.
@@ -39,6 +43,9 @@ namespace CampusAppWP8.Pages.Events
/// The is in speech.
private volatile bool isInSpeech = false;
+ /// The event model.
+ private RSSModel eventModel;
+
#endregion
#region Constructor
@@ -57,10 +64,16 @@ namespace CampusAppWP8.Pages.Events
ApplicationBarIconButton ttsBtn = new ApplicationBarIconButton();
ttsBtn.IconUri = new Uri(Icons.TextToSpeech, UriKind.Relative);
- ttsBtn.Text = AppResources.TextToSpeech_Btn;
+ ttsBtn.Text = AppResources.Add;
ttsBtn.Click += new EventHandler(this.EventTextToSpeech_Click);
ApplicationBar.Buttons.Add(ttsBtn);
+ ApplicationBarIconButton addCalBtn = new ApplicationBarIconButton();
+ addCalBtn.IconUri = new Uri(Icons.Calendar_Add, UriKind.Relative);
+ addCalBtn.Text = AppResources.TextToSpeech_Btn;
+ addCalBtn.Click += new EventHandler(this.AddCalender_Click);
+ ApplicationBar.Buttons.Add(addCalBtn);
+
this.isNewInstance = true;
this.synth = new SpeechSynthesizer();
@@ -229,6 +242,78 @@ namespace CampusAppWP8.Pages.Events
}
}
+ /// Event handler. Called by AddCalendar for click events.
+ /// Stubbfel, 19.11.2013.
+ /// parent pivot object.
+ /// Routed event information.
+ private void AddCalender_Click(object sender, EventArgs e)
+ {
+ this.eventModel = EventIndexPage.GetEventFeed().Model.Channel[0].Item[this.EventPivot.SelectedIndex];
+ AppointmentModel appoinment = this.CreateAppointment(this.eventModel);
+ string urlString = Constants.PathTimeTable_AppointmentEdit;
+
+ if (appoinment != null)
+ {
+ App.SaveToIsolatedStorage(Constants.IsolatedStorage_EventAppointment, ICSManager.ExportToICS(appoinment.CalendarObj));
+ urlString += "?" + Constants.ParamIsoKey + "=" + Constants.IsolatedStorage_EventAppointment;
+ }
+
+ Uri url = new Uri(urlString as string, UriKind.Relative);
+ NavigationService.Navigate(url);
+ }
+
+ /// Creates an appointment.
+ /// Stubbfel, 19.11.2013.
+ /// The event model.
+ /// The new appointment.
+ private AppointmentModel CreateAppointment(RSSModel eventModel)
+ {
+ if (eventModel == null)
+ {
+ return null;
+ }
+
+ CultureInfo german = Wp8StringManager.GermanCultur;
+ AppointmentModel appoinment = new AppointmentModel();
+ DateTime time = eventModel.DTTimestamp;
+ DTStart start = new DTStart();
+ start.Value = time;
+
+ string dateValue = eventModel.Title;
+
+ if (dateValue != null)
+ {
+ Summary summary = new Summary();
+ summary.Value = dateValue;
+ appoinment.SetValue(summary);
+ }
+
+ // set cat
+ Categories category = new Categories();
+ category.AddCategory("Veranstaltung");
+ appoinment.SetValue(category);
+
+ // set description
+ dateValue = this.eventModel.Text;
+ if (dateValue != null)
+ {
+ Description desc = new Description();
+ desc.Value = dateValue;
+ appoinment.SetValue(desc);
+ }
+
+ // set url
+ dateValue = this.eventModel.Link;
+ if (dateValue != null)
+ {
+ Url url = new Url();
+ url.Value = dateValue;
+ appoinment.SetValue(url);
+ }
+
+ return appoinment;
+ }
+
#endregion
#endregion
diff --git a/CampusAppWP8/CampusAppWP8/Pages/Lecture/ResultDetailPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Lecture/ResultDetailPage.xaml.cs
index 0f0b5749..6f242356 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/Lecture/ResultDetailPage.xaml.cs
+++ b/CampusAppWP8/CampusAppWP8/Pages/Lecture/ResultDetailPage.xaml.cs
@@ -100,8 +100,8 @@ namespace CampusAppWP8.Pages.Lecture
if (appoinment != null)
{
- App.SaveToIsolatedStorage("LectureAppointment", ICSManager.ExportToICS(appoinment.CalendarObj));
- // urlString += "?" + this.QuerryStringName + "=" + this.QuerryStringValue;
+ App.SaveToIsolatedStorage(Constants.IsolatedStorage_LectureAppointment, ICSManager.ExportToICS(appoinment.CalendarObj));
+ urlString += "?" + Constants.ParamIsoKey + "=" + Constants.IsolatedStorage_LectureAppointment;
}
Uri url = new Uri(urlString as string, UriKind.Relative);
diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx
index 6b2f5fd3..aff32e18 100644
--- a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx
+++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx
@@ -612,4 +612,10 @@
isolated
+
+ LectureAppointment
+
+
+ EventAppointment
+
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs
index 27b94665..c0ded70b 100644
--- a/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs
+++ b/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs
@@ -474,6 +474,15 @@ namespace CampusAppWP8.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die EventAppointment ähnelt.
+ ///
+ public static string IsolatedStorage_EventAppointment {
+ get {
+ return ResourceManager.GetString("IsolatedStorage_EventAppointment", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die IsolatedStorage_EventRSSModel ähnelt.
///
@@ -483,6 +492,15 @@ namespace CampusAppWP8.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die LectureAppointment ähnelt.
+ ///
+ public static string IsolatedStorage_LectureAppointment {
+ get {
+ return ResourceManager.GetString("IsolatedStorage_LectureAppointment", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die LectureModel ähnelt.
///