diff --git a/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/exams_159.png b/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/exams_159.png
new file mode 100644
index 00000000..6ada1ad4
Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/exams_159.png differ
diff --git a/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/exams_159.png b/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/exams_159.png
new file mode 100644
index 00000000..cc4f541d
Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/exams_159.png differ
diff --git a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj
index b2d262b0..8c591a6c 100644
--- a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj
+++ b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj
@@ -100,14 +100,19 @@
+
+
+
+
+
@@ -119,6 +124,9 @@
+
+ Exams.xaml
+
@@ -295,6 +303,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
@@ -396,6 +408,7 @@
+
@@ -409,6 +422,7 @@
+
diff --git a/CampusAppWP8/CampusAppWP8/Feed/Exams/ExamFeed.cs b/CampusAppWP8/CampusAppWP8/Feed/Exams/ExamFeed.cs
new file mode 100644
index 00000000..c2dc6ccb
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8/Feed/Exams/ExamFeed.cs
@@ -0,0 +1,59 @@
+//-----------------------------------------------------------------------
+//
+// Company copyright tag.
+//
+// stubbfel
+// 02.09.2013
+//----------------------------------------------------------------------
+namespace CampusAppWP8.Feed.Exams
+{
+ using System.IO;
+ using CampusAppWP8.Model;
+ using CampusAppWP8.Model.Exams;
+ using CampusAppWP8.Resources;
+
+ /// Exam feed.
+ /// Stubbfel, 02.09.2013.
+ public class ExamFeed : XmlModel
+ {
+ /// Initializes a new instance of the ExamFeed class.
+ /// Stubbfel, 02.09.2013.
+ public ExamFeed()
+ : base(ModelType.FileAndFeed, Constants.FileExamApp_ExamFeed, Constants.UrlExamApp_ExamFeed)
+ {
+ this.IsFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDate);
+ this.IsModelUpToDateOnLoad += new IsModelUpToDate(this.CheckIsModelUpToDate);
+ this.IsFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDate);
+ this.ValidRootName = Constants.ExamXmlValidRootName;
+ }
+
+ /// Check is model up to date.
+ /// Stubbfel, 02.09.2013.
+ /// The model.
+ /// true if it succeeds, false if it fails.
+ private bool CheckIsModelUpToDate(ExamListModel model)
+ {
+ if (model == null)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ /// Check is file up to date.
+ /// Stubbfel, 02.09.2013.
+ /// The model.
+ /// Information describing the file.
+ /// true if it succeeds, false if it fails.
+ private bool CheckIsFileUpToDate(ExamListModel model, FileInfo fileInfo)
+ {
+ if (fileInfo == null || !fileInfo.Exists || fileInfo.Length < 1)
+ {
+ return false;
+ }
+
+ return true;
+ }
+ }
+}
diff --git a/CampusAppWP8/CampusAppWP8/File/Exams/ExamFile.cs b/CampusAppWP8/CampusAppWP8/File/Exams/ExamFile.cs
new file mode 100644
index 00000000..bbd8ceb4
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8/File/Exams/ExamFile.cs
@@ -0,0 +1,94 @@
+//-----------------------------------------------------------------------
+//
+// Company copyright tag.
+//
+// stubbfel
+// 03.09.2013
+//----------------------------------------------------------------------
+
+namespace CampusAppWP8.File.Exams
+{
+ using System.IO;
+ using CampusAppWP8.Model;
+ using Windows.Storage;
+
+ /// Exam file.
+ /// Stubbfel, 03.09.2013.
+ public class ExamFile : BinaryModel
+ {
+ /// The storage file.
+ private StorageFile storageFile;
+
+ /// Initializes a new instance of the ExamFile class.
+ /// Stubbfel, 03.09.2013.
+ /// Filename of the file.
+ /// URL of the document.
+ public ExamFile(string fileName, string url)
+ : base(ModelType.FileAndFeed, fileName, url)
+ {
+ this.IsFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDate);
+ this.IsModelUpToDateOnLoad += new IsModelUpToDate(this.CheckIsModelUpToDate);
+ this.IsFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDate);
+ }
+
+ /// Executes the file operation.
+ /// Stubbfel, 03.09.2013.
+ public async void LaunchFile()
+ {
+ if (this.storageFile == null)
+ {
+ this.storageFile = await this.file.AsStorageFile();
+ }
+
+ if (this.storageFile != null)
+ {
+ var options = new Windows.System.LauncherOptions();
+ Windows.System.Launcher.LaunchFileAsync(this.storageFile);
+ }
+ }
+
+ /// Saves the and launch file.
+ /// Stubbfel, 03.09.2013.
+ public void SaveAndLaunchFile()
+ {
+ if (this.file.Exist())
+ {
+ this.LaunchFile();
+ }
+ else
+ {
+ this.OnSaved += new ExamFile.OnIO(this.LaunchFile);
+ this.SaveData();
+ }
+ }
+
+ /// Check is model up to date.
+ /// Stubbfel, 03.09.2013.
+ /// The model.
+ /// true if it succeeds, false if it fails.
+ private bool CheckIsModelUpToDate(byte[] model)
+ {
+ if (model == null)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ /// Check is file up to date.
+ /// Stubbfel, 03.09.2013.
+ /// The model.
+ /// Information describing the file.
+ /// true if it succeeds, false if it fails.
+ private bool CheckIsFileUpToDate(byte[] model, FileInfo fileInfo)
+ {
+ if (fileInfo == null || !fileInfo.Exists || fileInfo.Length < 1)
+ {
+ return false;
+ }
+
+ return true;
+ }
+ }
+}
diff --git a/CampusAppWP8/CampusAppWP8/Model/BinaryModel.cs b/CampusAppWP8/CampusAppWP8/Model/BinaryModel.cs
new file mode 100644
index 00000000..6cf9fe7b
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8/Model/BinaryModel.cs
@@ -0,0 +1,62 @@
+//-----------------------------------------------------------------------
+//
+// Company copyright tag.
+//
+// stubbfel
+// 03.09.2013
+//----------------------------------------------------------------------
+
+namespace CampusAppWP8.Model
+{
+ /// Binary model.
+ /// Stubbfel, 03.09.2013.
+ public abstract class BinaryModel : MainModel
+ {
+ /// Initializes a new instance of the BinaryModel class.
+ /// Stubbfel, 03.09.2013.
+ /// Type of the model.
+ /// Filename of the file.
+ /// URL of the document.
+ public BinaryModel(ModelType modelType, string fileName, string url)
+ : base(modelType, fileName, url)
+ {
+ }
+
+ /// Initializes a new instance of the BinaryModel class.
+ /// Stubbfel, 03.09.2013.
+ /// Type of the model.
+ /// Name of the source.
+ public BinaryModel(ModelType modelType, string sourceName)
+ : base(modelType, sourceName)
+ {
+ }
+
+ /// Deserialize model.
+ /// Stubbfel, 03.09.2013.
+ /// Information describing the model.
+ /// true if it succeeds, false if it fails.
+ protected override bool DeserializeModel(byte[] modelData)
+ {
+ bool retValue = true;
+
+ if (modelData != null)
+ {
+ this.Model = modelData;
+ }
+ else
+ {
+ retValue = false;
+ }
+
+ return retValue;
+ }
+
+ /// Gets the serialize model.
+ /// Stubbfel, 03.09.2013.
+ /// an byte Array.
+ protected override byte[] SerializeModel()
+ {
+ return this.Model;
+ }
+ }
+}
diff --git a/CampusAppWP8/CampusAppWP8/Model/Exams/ExamListModel.cs b/CampusAppWP8/CampusAppWP8/Model/Exams/ExamListModel.cs
new file mode 100644
index 00000000..12cbb196
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8/Model/Exams/ExamListModel.cs
@@ -0,0 +1,23 @@
+//-----------------------------------------------------------------------
+//
+// Company copyright tag.
+//
+// stubbfel
+// 02.09.2013
+//----------------------------------------------------------------------
+namespace CampusAppWP8.Model.Exams
+{
+ using System.Collections.ObjectModel;
+ using System.Xml.Serialization;
+
+ /// Exam list model.
+ /// Stubbfel, 02.09.2013.
+ [XmlRoot("links")]
+ public class ExamListModel
+ {
+ /// Gets or sets the exams.
+ /// The exams.
+ [XmlElement("link")]
+ public ObservableCollection Exams { get; set; }
+ }
+}
diff --git a/CampusAppWP8/CampusAppWP8/Model/Exams/ExamModel.cs b/CampusAppWP8/CampusAppWP8/Model/Exams/ExamModel.cs
new file mode 100644
index 00000000..57752d26
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8/Model/Exams/ExamModel.cs
@@ -0,0 +1,67 @@
+//-----------------------------------------------------------------------
+//
+// Company copyright tag.
+//
+// stubbfel
+// 02.09.2013
+//----------------------------------------------------------------------
+namespace CampusAppWP8.Model.Exams
+{
+ using System.Xml.Serialization;
+ using CampusAppWP8.Utility;
+
+ /// Exam model.
+ /// Stubbfel, 02.09.2013.
+ public class ExamModel
+ {
+ /// Gets or sets the course number.
+ /// The course number.
+ [XmlAttribute("stg")]
+ public string CourseNumber { get; set; }
+
+ /// Gets or sets the course text.
+ /// The course text.
+ [XmlAttribute("stgtext")]
+ public string CourseText { get; set; }
+
+ /// Gets or sets the degree number.
+ /// The degree number.
+ [XmlAttribute("abschl")]
+ public string DegreeNumber { get; set; }
+
+ /// Gets or sets the version.
+ /// The version.
+ [XmlAttribute("pversion")]
+ public string Version { get; set; }
+
+ /// Gets or sets the type.
+ /// The type.
+ [XmlAttribute("typ")]
+ public string Type { get; set; }
+
+ /// Gets or sets the title.
+ /// The title.
+ [XmlAttribute("dtxt")]
+ public string Title { get; set; }
+
+ /// Gets or sets the date.
+ /// The date.
+ [XmlAttribute("datum")]
+ public string Date { get; set; }
+
+ /// Gets or sets the link.
+ /// The link.
+ [XmlAttribute("link")]
+ public string Link { get; set; }
+
+ /// Gets the caption.
+ /// The caption.
+ public string Caption
+ {
+ get
+ {
+ return StringManager.StripHTML(this.CourseText + " (" + this.Type + "/" + this.Version + ")");
+ }
+ }
+ }
+}
diff --git a/CampusAppWP8/CampusAppWP8/Model/MainModel.cs b/CampusAppWP8/CampusAppWP8/Model/MainModel.cs
index 8a549d87..6a01db2b 100644
--- a/CampusAppWP8/CampusAppWP8/Model/MainModel.cs
+++ b/CampusAppWP8/CampusAppWP8/Model/MainModel.cs
@@ -11,7 +11,6 @@ namespace CampusAppWP8
using System.Collections.Generic;
using System.IO;
using System.Net;
- using System.Text;
using CampusAppWP8.Model.Utility;
using CampusAppWP8.Utility;
@@ -19,8 +18,13 @@ namespace CampusAppWP8
/// Base model io handling class.
///
/// model type
- public abstract class MainModel : IDisposable
+ public abstract class MainModel
{
+ ///
+ /// File object.
+ ///
+ protected CampusAppWP8.Utility.File file = null;
+
///
/// Model io type.
///
@@ -31,11 +35,6 @@ namespace CampusAppWP8
///
private T model = default(T);
- ///
- /// File object.
- ///
- private CampusAppWP8.Utility.File file = null;
-
///
/// Web object.
///
@@ -88,14 +87,6 @@ namespace CampusAppWP8
}
}
- ///
- /// Finalizes an instance of the class.
- ///
- ~MainModel()
- {
- this.SaveData();
- }
-
///
/// Delegate of the OnIO callback function.
///
@@ -238,14 +229,6 @@ namespace CampusAppWP8
}
}
- ///
- /// Called before finalizing. Can maybe be removed.
- ///
- public void Dispose()
- {
- this.SaveData();
- }
-
///
/// Forces a update from web.
///
@@ -335,7 +318,7 @@ namespace CampusAppWP8
{
if (this.file != null)
{
- string data = this.file.ReadFile();
+ byte[] data = this.file.ReadFile();
if (data == null)
{
@@ -343,9 +326,9 @@ namespace CampusAppWP8
}
else
{
- if (!data.Equals(string.Empty))
+ if (data.Length > 0)
{
- this.DeserializeModel(Encoding.UTF8.GetBytes(data));
+ this.DeserializeModel(data);
}
this.RunOnIOCallback(this.OnLoaded);
@@ -494,7 +477,7 @@ namespace CampusAppWP8
if ((this.IsFile() == true)
&& (fileName.Equals(string.Empty) == false))
{
- this.InitFile(CampusAppWP8.Utility.File.IOTypeRead.ReadSync, CampusAppWP8.Utility.File.IOTypeWrite.WriteAsync);
+ this.InitFile();
}
if ((this.IsHttpApi() == true)
@@ -507,16 +490,12 @@ namespace CampusAppWP8
///
/// Initializes the file object.
///
- /// read io type (Default: sync)
- /// write io type (Default: async)
- private void InitFile(
- CampusAppWP8.Utility.File.IOTypeRead readType = CampusAppWP8.Utility.File.IOTypeRead.ReadSync,
- CampusAppWP8.Utility.File.IOTypeWrite writeType = CampusAppWP8.Utility.File.IOTypeWrite.WriteAsync)
+ private void InitFile()
{
if ((this.IsFile() == true)
&& (this.file == null))
{
- this.file = new CampusAppWP8.Utility.File(this.fileName, readType, writeType);
+ this.file = new CampusAppWP8.Utility.File(this.fileName);
}
}
@@ -537,7 +516,7 @@ namespace CampusAppWP8
///
/// sending object
/// event args
- private void OnLoadDataComplete(object sender, DownloadStringCompletedEventArgs e)
+ private void OnLoadDataComplete(object sender, OpenReadCompletedEventArgs e)
{
Exception downloadError = e.Error;
if (downloadError != null)
@@ -546,11 +525,16 @@ namespace CampusAppWP8
}
else
{
- string downloadResult = e.Result;
-
- if (downloadResult != null && !downloadResult.Equals(string.Empty))
+ byte[] data;
+ using (MemoryStream ms = new MemoryStream())
{
- this.DeserializeModel(Encoding.UTF8.GetBytes(downloadResult));
+ e.Result.CopyTo(ms);
+ data = ms.ToArray();
+ }
+
+ if (data != null && data.Length > 0)
+ {
+ this.DeserializeModel(data);
}
this.RunOnIOCallback(this.OnLoaded);
diff --git a/CampusAppWP8/CampusAppWP8/Model/XmlModel.cs b/CampusAppWP8/CampusAppWP8/Model/XmlModel.cs
index e606f082..5a2cbdbe 100644
--- a/CampusAppWP8/CampusAppWP8/Model/XmlModel.cs
+++ b/CampusAppWP8/CampusAppWP8/Model/XmlModel.cs
@@ -15,7 +15,7 @@ namespace CampusAppWP8.Model
/// Xml model io handler class.
///
/// model type
- public class XmlModel : MainModel
+ public abstract class XmlModel : MainModel
{
///
/// Initializes a new instance of the class.
diff --git a/CampusAppWP8/CampusAppWP8/Pages/Exams/Exams.xaml b/CampusAppWP8/CampusAppWP8/Pages/Exams/Exams.xaml
new file mode 100644
index 00000000..c4a7d7cd
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8/Pages/Exams/Exams.xaml
@@ -0,0 +1,81 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8/Pages/Exams/Exams.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Exams/Exams.xaml.cs
new file mode 100644
index 00000000..6bcaebe2
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8/Pages/Exams/Exams.xaml.cs
@@ -0,0 +1,203 @@
+//
+// Company copyright tag.
+//
+// stubbfel
+// 02.09.2013
+//----------------------------------------------------------------------
+namespace CampusAppWP8.Pages.Exams
+{
+ using System.Linq;
+ using System.Windows;
+ using System.Windows.Controls;
+ using System.Windows.Navigation;
+ using CampusAppWP8.Feed.Exams;
+ using CampusAppWP8.File.Exams;
+ using CampusAppWP8.Resources;
+ using CampusAppWP8.Utility;
+ using CampusAppWP8.Utility.Lui.MessageBoxes;
+ using Microsoft.Phone.Controls;
+
+ /// class of ExamsPage.
+ /// Stubbfel, 02.09.2013.
+ public partial class Exams : PhoneApplicationPage
+ {
+ /// The feed.
+ private ExamFeed feed;
+
+ /// The exam file.
+ private ExamFile file;
+
+ /// Initializes a new instance of the Exams class.
+ /// Stubbfel, 02.09.2013.
+ public Exams()
+ {
+ this.InitializeComponent();
+ this.InitializeFeed();
+ }
+
+ /// Wird aufgerufen, wenn eine Seite die aktive Seite in einem Frame wird.
+ /// Stubbfel, 02.09.2013.
+ /// Ein Objekt, das die Ereignisdaten enthält.
+ protected override void OnNavigatedTo(NavigationEventArgs e)
+ {
+ base.OnNavigatedTo(e);
+ if (this.feed == null)
+ {
+ this.InitializeFeed();
+ }
+
+ this.ProgressBar.Visibility = System.Windows.Visibility.Visible;
+ this.feed.LoadData(Utilities.getLoadModus());
+ }
+
+ ///
+ /// Wird aufgerufen, wenn eine Seite nicht mehr die aktive Seite in einem Frame ist.
+ ///
+ /// Stubbfel, 02.09.2013.
+ /// Ein Objekt, das die Ereignisdaten enthält.
+ protected override void OnNavigatedFrom(NavigationEventArgs e)
+ {
+ if (NavigationMode.Back == e.NavigationMode)
+ {
+ App.SaveToIsolatedStorage(Constants.ExamPageModelKey, -1);
+ this.feed.SaveData();
+ }
+ else
+ {
+ App.SaveToIsolatedStorage(Constants.ExamPageModelKey, this.ExamPivot.SelectedIndex);
+ }
+ }
+
+ /// Method initialize the Feed.
+ /// Stubbfel, 02.09.2013.
+ private void InitializeFeed()
+ {
+ this.feed = new ExamFeed();
+ this.feed.OnLoaded += new ExamFeed.OnIO(this.FeedIsReady);
+ this.feed.OnFailedWeb += new ExamFeed.OnFailed(this.FeedIsFailWeb);
+ this.feed.OnFailedFile += new ExamFeed.OnFailed(this.FeedIsFailFile);
+ }
+
+ /// Method will be execute if the feed is ready.
+ /// Stubbfel, 02.09.2013.
+ private void FeedIsReady()
+ {
+ this.SetupExamList();
+ this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed;
+ }
+
+ /// Executes the PDF reader operation.
+ /// Stubbfel, 03.09.2013.
+ private void LaunchPDFReader()
+ {
+ this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed;
+ this.file.SaveAndLaunchFile();
+ }
+
+ /// Sets up the exam list.
+ /// Stubbfel, 02.09.2013.
+ private void SetupExamList()
+ {
+ var bachelorList = from exam in this.feed.Model.Exams
+ where exam.DegreeNumber.Equals(((int)CampusAppWP8.Model.Setting.UserProfilModel.DegreeType.BACHELOR).ToString())
+ orderby exam.CourseText, exam.Version
+ select exam;
+
+ var masterList = from exam in this.feed.Model.Exams
+ where exam.DegreeNumber.Equals(((int)CampusAppWP8.Model.Setting.UserProfilModel.DegreeType.MASTER).ToString())
+ orderby exam.CourseText, exam.Version
+ select exam;
+
+ var diplomaList = from exam in this.feed.Model.Exams
+ where exam.DegreeNumber.Equals(((int)CampusAppWP8.Model.Setting.UserProfilModel.DegreeType.DIPLOM).ToString())
+ orderby exam.CourseText, exam.Version
+ select exam;
+
+ this.BachelorPanel.ItemsSource = bachelorList;
+ this.MasterPanel.ItemsSource = masterList;
+ this.DiplomaPanel.ItemsSource = diplomaList;
+ this.ExamPivot.SelectedIndex = this.CalcSelectedIndex();
+ }
+
+ /// Calculates the selected index.
+ /// Stubbfel, 02.09.2013.
+ /// The calculated selected index.
+ private int CalcSelectedIndex()
+ {
+ int result = App.LoadFromIsolatedStorage(Constants.ExamPageModelKey);
+ if (result < 0 || result > 2)
+ {
+ Model.Setting.UserProfilModel.DegreeType degree = Settings.UserProfil.Degree;
+
+ switch (degree)
+ {
+ case Model.Setting.UserProfilModel.DegreeType.BACHELOR:
+ result = 0;
+ break;
+ case Model.Setting.UserProfilModel.DegreeType.MASTER:
+ result = 1;
+ break;
+ case Model.Setting.UserProfilModel.DegreeType.DIPLOM:
+ result = 2;
+ break;
+ default:
+ result = 0;
+ break;
+ }
+ }
+
+ return result;
+ }
+
+ /// Method will be execute if the feed is failed.
+ /// Stubbfel, 02.09.2013.
+ private void FeedIsFailWeb()
+ {
+ MessageBoxResult result = MessageBoxes.ShowMainModelErrorMessageBox(AppResources.MsgBox_ErrorMainModelLoadWeb);
+ this.feed.ForceReadFile();
+ }
+
+ /// Method will be execute if the feed is failed.
+ /// Stubbfel, 02.09.2013.
+ private void FeedIsFailFile()
+ {
+ MessageBoxResult result = MessageBoxes.ShowMainModelErrorMessageBox(AppResources.MsgBox_ErrorMainModelLoadFile);
+ this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed;
+ }
+
+ /// Event handler. Called by Button for click events.
+ /// Stubbfel, 03.09.2013.
+ /// Source of the event.
+ /// Routed event information.
+ private void Button_Click(object sender, RoutedEventArgs e)
+ {
+ Button button = sender as Button;
+ if (button == null)
+ {
+ return;
+ }
+
+ string url = button.Tag as string;
+ if (url == null)
+ {
+ return;
+ }
+
+ // create filename
+ string[] filenames = url.Split('/');
+ string filename = url;
+
+ if (filenames.Length > 0)
+ {
+ filename = filenames[filenames.Length - 1];
+ }
+
+ this.file = new ExamFile(filename, url);
+ this.file.OnLoaded += new ExamFile.OnIO(this.LaunchPDFReader);
+ this.file.OnFailedWeb += new ExamFile.OnFailed(this.FeedIsFailWeb);
+ this.file.OnFailedFile += new ExamFile.OnFailed(this.FeedIsFailFile);
+ this.file.LoadData();
+ this.ProgressBar.Visibility = System.Windows.Visibility.Visible;
+ }
+ }
+}
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml
index df83d9b0..99e5cc03 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml
+++ b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml
@@ -158,6 +158,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs
index 9d229538..86a670dd 100644
--- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs
+++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs
@@ -222,6 +222,24 @@ namespace CampusAppWP8.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die Prüfungsordnungen ähnelt.
+ ///
+ public static string ExaminationApp_Header {
+ get {
+ return ResourceManager.GetString("ExaminationApp_Header", resourceCulture);
+ }
+ }
+
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die Prüfungs- ordnungen ähnelt.
+ ///
+ public static string ExaminationApp_Title {
+ get {
+ return ResourceManager.GetString("ExaminationApp_Title", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die Fakultät ähnelt.
///
diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx
index 0f2c1050..43dcd186 100644
--- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx
+++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx
@@ -419,4 +419,10 @@
Nur mit Wlan laden
+
+ Prüfungs- ordnungen
+
+
+ Prüfungsordnungen
+
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs
index 0de55340..ca04fe9e 100644
--- a/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs
+++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs
@@ -132,6 +132,24 @@ namespace CampusAppWP8.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die ExamsPage.LastPivotIndex ähnelt.
+ ///
+ public static string ExamPageModelKey {
+ get {
+ return ResourceManager.GetString("ExamPageModelKey", resourceCulture);
+ }
+ }
+
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die links ähnelt.
+ ///
+ public static string ExamXmlValidRootName {
+ get {
+ return ResourceManager.GetString("ExamXmlValidRootName", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die DepartmentFavoriteFeed.xml ähnelt.
///
@@ -159,6 +177,15 @@ namespace CampusAppWP8.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die examlist.xml ähnelt.
+ ///
+ public static string FileExamApp_ExamFeed {
+ get {
+ return ResourceManager.GetString("FileExamApp_ExamFeed", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die ClubLinks.xml ähnelt.
///
@@ -609,6 +636,15 @@ namespace CampusAppWP8.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die /Pages/Exams/Exams.xaml ähnelt.
+ ///
+ public static string PathExams_ExamsPage {
+ get {
+ return ResourceManager.GetString("PathExams_ExamsPage", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die /Pages/Lecture/LecturePage.xaml ähnelt.
///
@@ -816,6 +852,15 @@ namespace CampusAppWP8.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die https://www.zv.tu-cottbus.de/CMS-Webservice/Pruefungsordnung/Uebersicht ähnelt.
+ ///
+ public static string UrlExamApp_ExamFeed {
+ get {
+ return ResourceManager.GetString("UrlExamApp_ExamFeed", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die http://www.zv.tu-cottbus.de/LSFveranst/LSF4 ähnelt.
///
diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx
index ef601ff0..827f5f98 100644
--- a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx
+++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx
@@ -435,4 +435,19 @@
SearchAlias
+
+ /Pages/Exams/Exams.xaml
+
+
+ links
+
+
+ examlist.xml
+
+
+ https://www.zv.tu-cottbus.de/CMS-Webservice/Pruefungsordnung/Uebersicht
+
+
+ ExamsPage.LastPivotIndex
+
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8/Resources/Icons.cs b/CampusAppWP8/CampusAppWP8/Resources/Icons.cs
index 4d91d96d..d381d0e4 100644
--- a/CampusAppWP8/CampusAppWP8/Resources/Icons.cs
+++ b/CampusAppWP8/CampusAppWP8/Resources/Icons.cs
@@ -99,6 +99,17 @@ namespace CampusAppWP8.Resources
}
}
+ ///
+ /// Gets the uri string of the Exams icon.
+ ///
+ public static string Exams
+ {
+ get
+ {
+ return Themerize("exams_159.png");
+ }
+ }
+
///
/// Gets the uri string of the Favorite icon.
///
diff --git a/CampusAppWP8/CampusAppWP8/Resources/Icons.resx b/CampusAppWP8/CampusAppWP8/Resources/Icons.resx
index 7cd96949..4a349994 100644
--- a/CampusAppWP8/CampusAppWP8/Resources/Icons.resx
+++ b/CampusAppWP8/CampusAppWP8/Resources/Icons.resx
@@ -138,6 +138,9 @@
departments_159.png
+
+ exams_159.png
+
favorite_159.png
diff --git a/CampusAppWP8/CampusAppWP8/Utility/File.cs b/CampusAppWP8/CampusAppWP8/Utility/File.cs
index 189a7250..3a444a0d 100644
--- a/CampusAppWP8/CampusAppWP8/Utility/File.cs
+++ b/CampusAppWP8/CampusAppWP8/Utility/File.cs
@@ -10,6 +10,7 @@ namespace CampusAppWP8.Utility
using System;
using System.IO;
using System.Threading;
+ using System.Threading.Tasks;
using Windows.Storage;
///
@@ -27,27 +28,12 @@ namespace CampusAppWP8.Utility
///
private string filename = string.Empty;
- ///
- /// Read type.
- ///
- private IOTypeRead readType;
-
- ///
- /// Write type.
- ///
- private IOTypeWrite writeType;
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// file name
- /// read type
- /// write type
- public File(string filename, IOTypeRead read, IOTypeWrite write)
+ /// Initializes a new instance of the class.
+ /// Stubbfel, 03.09.2013.
+ /// file name.
+ public File(string filename)
{
this.filename = filename;
- this.readType = (read == IOTypeRead.INVALID) ? IOTypeRead.ReadAsync : read;
- this.writeType = write;
}
///
@@ -55,113 +41,28 @@ namespace CampusAppWP8.Utility
///
public delegate void WriteCallbackFunc();
- ///
- /// IO read type ENUM.
- ///
- public enum IOTypeRead
+ /// Read data from file to a string.
+ /// Stubbfel, 03.09.2013.
+ /// data string.
+ public byte[] ReadFile()
{
- ///
- /// Invalid/unset state.
- ///
- INVALID = 0,
-
- ///
- /// Sync read.
- ///
- ReadSync = 1,
-
- ///
- /// Async read.
- ///
- ReadAsync = 2
- }
-
- ///
- /// IO write type ENUM.
- ///
- public enum IOTypeWrite
- {
- ///
- /// Invalid/unset state.
- ///
- INVALID = 0,
-
- ///
- /// Sync write.
- ///
- WriteSync = 1,
-
- ///
- /// Async write.
- ///
- WriteAsync = 2,
-
- ///
- /// Read only, no writing.
- ///
- ReadOnly = 3
- }
-
- ///
- /// Read data from file to a string.
- ///
- /// read type
- /// data string
- public string ReadFile(IOTypeRead ioType = IOTypeRead.INVALID)
- {
- string retValue = null;
+ byte[] retValue = null;
if (this.Exist() == true)
{
- IOTypeRead tempType = ioType;
-
- if (tempType == IOTypeRead.INVALID)
- {
- tempType = this.readType;
- }
-
- if (tempType == IOTypeRead.ReadAsync)
- {
- // retValue = this.ReadAsync();
- retValue = this.ReadSync();
- }
- else if (tempType == IOTypeRead.ReadSync)
- {
- retValue = this.ReadSync();
- }
+ retValue = this.ReadSync();
}
return retValue;
}
- ///
- /// Write bytes to the file.
- ///
- /// data byte array.
- /// callback function, called after writing is done.
+ /// Write bytes to the file.
+ /// Stubbfel, 03.09.2013.
+ /// data byte array.
+ /// callback function, called after writing is done.
/// callback function, called when writing failed.
- /// write type.
- public void WriteFile(byte[] data, WriteCallbackFunc onSavedCallback, WriteCallbackFunc onFailedCallback, IOTypeWrite ioType = IOTypeWrite.INVALID)
+ public void WriteFile(byte[] data, WriteCallbackFunc onSavedCallback, WriteCallbackFunc onFailedCallback)
{
- IOTypeWrite tempType = ioType;
-
- if (tempType == IOTypeWrite.INVALID)
- {
- tempType = this.writeType;
- }
-
- /*
- if (tempType == IOTypeWrite.WriteAsync)
- {
- this.WriteAsync(data, onSavedCallback, onFailedCallback);
- }
- else if (tempType == IOTypeWrite.WriteSync)
- {
- // this.WriteSync(data);
- this.WriteAsync(data, onSavedCallback, onFailedCallback);
- }
- */
-
Thread th = new Thread(delegate() { this.WriteAsync(data, onSavedCallback, onFailedCallback); });
th.Start();
}
@@ -185,48 +86,39 @@ namespace CampusAppWP8.Utility
return this.GetFileInfo().Exists;
}
+ /// Converts this object to a storage file.
+ /// Stubbfel, 03.09.2013.
+ /// Storage File
+ public async Task AsStorageFile()
+ {
+ if (this.Exist())
+ {
+ return await File.LocalFolder.GetFileAsync(this.filename);
+ }
+
+ return null;
+ }
+
///
/// Read data synchronous from file.
///
/// data string
- private string ReadSync()
+ private byte[] ReadSync()
{
- string retValue = null;
+ byte[] retValue = null;
using (Stream fileStream = File.LocalFolder.OpenStreamForReadAsync(this.filename).Result)
{
- using (StreamReader streamReader = new StreamReader(fileStream))
+ using (MemoryStream ms = new MemoryStream())
{
- retValue = streamReader.ReadToEnd();
+ fileStream.CopyTo(ms);
+ retValue = ms.ToArray();
}
}
return retValue;
}
- ///
- /// Read data asynchronous from file.
- ///
- /// data string
- private string ReadAsync()
- {
- string retValue = string.Empty;
-
- return retValue;
- }
-
- ///
- /// Write data synchronous to file.
- ///
- /// data array
- /// true, if succeeded
- private bool WriteSync(byte[] data)
- {
- bool retValue = true;
-
- return retValue;
- }
-
///
/// Write data asynchronous to file.
///
diff --git a/CampusAppWP8/CampusAppWP8/Utility/HttpRequest.cs b/CampusAppWP8/CampusAppWP8/Utility/HttpRequest.cs
index 810bd29b..e8cd4db7 100644
--- a/CampusAppWP8/CampusAppWP8/Utility/HttpRequest.cs
+++ b/CampusAppWP8/CampusAppWP8/Utility/HttpRequest.cs
@@ -60,6 +60,17 @@ namespace CampusAppWP8.Utility
client.DownloadStringAsync(url);
}
+ /// Method realize the http-get-method resource.
+ /// Stubbfel, 03.09.2013.
+ /// Url of the resource.
+ /// The action.
+ public void HttpGet(Uri url, Action