From 52625e6bee3c733a662bef01e4b0f07323765cc6 Mon Sep 17 00:00:00 2001 From: stubbfel Date: Mon, 17 Jun 2013 11:25:08 +0200 Subject: [PATCH 1/6] init #33 --- CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj | 1 + CampusAppWP8/CampusAppWP8/Utility/XmlApi.cs | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 CampusAppWP8/CampusAppWP8/Utility/XmlApi.cs diff --git a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj index f27a3dc3..c022ab30 100644 --- a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj +++ b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj @@ -179,6 +179,7 @@ + diff --git a/CampusAppWP8/CampusAppWP8/Utility/XmlApi.cs b/CampusAppWP8/CampusAppWP8/Utility/XmlApi.cs new file mode 100644 index 00000000..c0753741 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Utility/XmlApi.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CampusAppWP8.Utility +{ + public class XmlApi + { + } +} From 25b05855a2c037e5f9e03e58d7fa9ebf16213de9 Mon Sep 17 00:00:00 2001 From: stubbfel Date: Mon, 17 Jun 2013 11:50:01 +0200 Subject: [PATCH 2/6] finish xmlApi --- CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj | 1 + .../CampusAppWP8/Utility/ApiEventHandler.cs | 46 ++++++++ CampusAppWP8/CampusAppWP8/Utility/XmlApi.cs | 108 +++++++++++++++++- CampusAppWP8/CampusAppWP8/utility/XMLFeed.cs | 3 + 4 files changed, 156 insertions(+), 2 deletions(-) create mode 100644 CampusAppWP8/CampusAppWP8/Utility/ApiEventHandler.cs diff --git a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj index c022ab30..190ec908 100644 --- a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj +++ b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj @@ -171,6 +171,7 @@ True Constants.resx + diff --git a/CampusAppWP8/CampusAppWP8/Utility/ApiEventHandler.cs b/CampusAppWP8/CampusAppWP8/Utility/ApiEventHandler.cs new file mode 100644 index 00000000..f90b2ec4 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Utility/ApiEventHandler.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CampusAppWP8.Utility +{ + /// + /// This class handle the events of a api + /// + public class ApiEventHandler + { + /// + /// Initializes a new instance of the class. + /// + public ApiEventHandler() + { + } + + #region Delegate&Events + /// + /// Delegate for the ready event + /// + public delegate void ApiReadyHandler(); + + /// + /// The ready event + /// + public event ApiReadyHandler ApiIsReadyEvent; + + #endregion + + #region Method + + /// + /// Method fire a ready event + /// + public void FireApiReadyevent() + { + this.ApiIsReadyEvent(); + } + + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Utility/XmlApi.cs b/CampusAppWP8/CampusAppWP8/Utility/XmlApi.cs index c0753741..fc700f3c 100644 --- a/CampusAppWP8/CampusAppWP8/Utility/XmlApi.cs +++ b/CampusAppWP8/CampusAppWP8/Utility/XmlApi.cs @@ -1,12 +1,116 @@ -using System; +using CampusAppWP8.Resources; +using System; using System.Collections.Generic; using System.Linq; +using System.Net; using System.Text; using System.Threading.Tasks; +using System.Xml.Linq; +using System.Xml.Serialization; namespace CampusAppWP8.Utility { - public class XmlApi + public class XmlApi : RestApi { + /// + /// The model of the feed + /// + private T model; + + protected string validRootName = Constants.XMLRootElementName; + + /// + /// EventHandler of the api + /// + private readonly ApiEventHandler eventHandler; + + public XmlApi(Uri apiBaseAddress): base(apiBaseAddress) + { + this.eventHandler = new ApiEventHandler(); + } + + /// + /// Gets or sets for the model of the feed + /// + public T Model + { + get + { + return this.model; + } + + set + { + if ((value == null && this.model != null) || !value.Equals(this.model)) + { + this.model = value; + } + } + } + + /// + /// Gets for the event-handler of the feed + /// + public ApiEventHandler EventHandler + { + get { return this.eventHandler; } + } + + /// + /// Method will be execute if the download of the feed is completed and create the model + /// + /// Sender of the event + /// Arguments of the event + public void DownloadCompleted(object sender, DownloadStringCompletedEventArgs e) + { + Exception downloadError = e.Error; + if (downloadError != null) + { + return; + } + + string downloadResult = e.Result; + if (downloadResult != null && !downloadResult.Equals(string.Empty)) + { + this.CreateModel(downloadResult); + } + } + + /// + /// Method create the model of the feed + /// + /// content of the feed + private void CreateModel(string xmlString) + { + if (xmlString == null || xmlString == string.Empty) + { + return; + } + + this.Deserialization(xmlString); + this.EventHandler.FireApiReadyevent(); + } + + /// + /// Method implement the deserialization a Xml-feed + /// + /// content of the feed + protected override void Deserialization(string feedString) + { + XmlSerializer serializer = new XmlSerializer(typeof(T)); + XDocument document = XDocument.Parse(feedString); + if (!document.Root.Name.ToString().Equals(validRootName)) + { + XElement content = document.Root; + document = new XDocument(); + document.Add(new XElement(validRootName, content)); + } + + T model = (T)serializer.Deserialize(document.CreateReader()); + if (model != null) + { + this.Model = model; + } + } } } diff --git a/CampusAppWP8/CampusAppWP8/utility/XMLFeed.cs b/CampusAppWP8/CampusAppWP8/utility/XMLFeed.cs index 5b49b20d..6efa3610 100644 --- a/CampusAppWP8/CampusAppWP8/utility/XMLFeed.cs +++ b/CampusAppWP8/CampusAppWP8/utility/XMLFeed.cs @@ -18,6 +18,9 @@ namespace CampusAppWP8.Utility /// Type for model of the feed public abstract class XmlFeed : Feed { + /// + /// Variablo for the name of the roottag + /// protected string validRootName = Constants.XMLRootElementName; #region Constructor From e451f7ff89ec508d1fa840bd774acdc7bfcc3f39 Mon Sep 17 00:00:00 2001 From: stubbfel Date: Mon, 17 Jun 2013 12:14:02 +0200 Subject: [PATCH 3/6] add CreateGetUrl #33 --- .../CampusAppWP8/Model/Utility/URLParamModel.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CampusAppWP8/CampusAppWP8/Model/Utility/URLParamModel.cs b/CampusAppWP8/CampusAppWP8/Model/Utility/URLParamModel.cs index 7ea84ed4..c8d9c1a2 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Utility/URLParamModel.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Utility/URLParamModel.cs @@ -10,7 +10,7 @@ namespace CampusAppWP8.Model.Utility /// /// This class is a Model for the URLParameter like GET-Parameter /// - public class URLParamModel + public class UrlParamModel { #region Members @@ -24,20 +24,20 @@ namespace CampusAppWP8.Model.Utility #region Constructor /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// the key for the parameter - public URLParamModel(string key) + public UrlParamModel(string key) { this.key = key; } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// the key for the parameter> /// value of the parameter - public URLParamModel(string key, string value) + public UrlParamModel(string key, string value) { this.key = key; this.Value = value; From a2463795f92540c4b2147c0474a62026c5609c90 Mon Sep 17 00:00:00 2001 From: stubbfel Date: Mon, 17 Jun 2013 12:39:05 +0200 Subject: [PATCH 4/6] add Api to LecturePage --- CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj | 4 +- .../CampusAppWP8/Feed/Lecture/LectureApi.cs | 33 +++++++++ .../CampusAppWP8/Feed/Lecture/LectureFeed.cs | 67 ------------------- .../Pages/Lecture/LecturePage.xaml.cs | 30 ++++++--- .../CampusAppWP8/Properties/WMAppManifest.xml | 2 +- .../Resources/Constants.Designer.cs | 9 +++ .../CampusAppWP8/Resources/Constants.resx | 3 + CampusAppWP8/CampusAppWP8/Utility/RestApi.cs | 17 +++++ CampusAppWP8/CampusAppWP8/Utility/XmlApi.cs | 16 ++++- 9 files changed, 100 insertions(+), 81 deletions(-) create mode 100644 CampusAppWP8/CampusAppWP8/Feed/Lecture/LectureApi.cs delete mode 100644 CampusAppWP8/CampusAppWP8/Feed/Lecture/LectureFeed.cs diff --git a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj index 190ec908..ed296e29 100644 --- a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj +++ b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj @@ -111,11 +111,11 @@ - + CampusMapPage.xaml - + DepartmentPage.xaml diff --git a/CampusAppWP8/CampusAppWP8/Feed/Lecture/LectureApi.cs b/CampusAppWP8/CampusAppWP8/Feed/Lecture/LectureApi.cs new file mode 100644 index 00000000..3f80c5e2 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Feed/Lecture/LectureApi.cs @@ -0,0 +1,33 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 13.06.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Feed.Lecture +{ + using System; + using CampusAppWP8.Model.Lecture; + using CampusAppWP8.Utility; + using CampusAppWP8.Resources; + + /// + /// Class for the feed of the Lecture + /// + /// + /// need the XmlAPI + /// + public class LectureApi : XmlApi + { + /// + /// Initializes a new instance of the class. + /// + /// the RequestUrl + public LectureApi() + : base(new Uri(Constants.UrlLectureApiBaseAddr)) + { + this.validRootName = "lsf_auszug"; + } + } +} diff --git a/CampusAppWP8/CampusAppWP8/Feed/Lecture/LectureFeed.cs b/CampusAppWP8/CampusAppWP8/Feed/Lecture/LectureFeed.cs deleted file mode 100644 index b635d51b..00000000 --- a/CampusAppWP8/CampusAppWP8/Feed/Lecture/LectureFeed.cs +++ /dev/null @@ -1,67 +0,0 @@ -//----------------------------------------------------------------------- -// -// Company copyright tag. -// -// stubbfel -// 13.06.2013 -//---------------------------------------------------------------------- -namespace CampusAppWP8.Feed.Lecture -{ - using System; - using CampusAppWP8.Model.Lecture; - using CampusAppWP8.Utility; - - /// - /// Class for the feed of the Lecture - /// - /// - /// need the XmlAPI - /// - public class LectureFeed : XmlFeed - { - /// - /// Initializes a new instance of the class. - /// - /// the RequestUrl - public LectureFeed(Uri url) - : base(url, "Lecture.xml") - { - this.validRootName = "lsf_auszug"; - } - - /// - /// Method create the RequestUrl - /// - /// - /// have to refactors - /// - /// value of the semester - /// value of the degree - /// value of the course - /// value of the from - /// value of the to - /// return the requestUrl - public static Uri CreateFeedUrl(string semester, string degree, string course, string from, string to) - { - return new Uri("http://www.zv.tu-cottbus.de/LSFveranst/LSF4?Semester=" + semester + "&Abschluss=" + degree + "&Studiengang=" + course + "&Von=" + from + "&Bis=" + to); - } - - /// - /// Method implement CheckIsModelUpToDate()-Method - /// - /// true, if model is up-to-date, otherwise false - protected override bool CheckIsModelUpToDate() - { - return false; - } - - /// - /// Method implement CheckIsFileUpToDate()-Method - /// - /// true, if file is up-to-date, otherwise false - protected override bool CheckIsFileUpToDate() - { - return false; - } - } -} diff --git a/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs index f88b2de0..9602344f 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs @@ -26,7 +26,7 @@ namespace CampusAppWP8.Pages.Lecture /// /// actual LectureFeed /// - private LectureFeed feed; + private LectureApi api; /// /// List for the courses of the BTU @@ -141,25 +141,37 @@ namespace CampusAppWP8.Pages.Lecture /// sender of this event /// events arguments private void SendRequest(object sender, RoutedEventArgs e) + { + this.api = new LectureApi(); + this.api.EventHandler.ApiIsReadyEvent += new ApiEventHandler.ApiReadyHandler(this.ApiIsReady); + this.ProgressBar.Visibility = System.Windows.Visibility.Visible; + List parameterList = this.CreateUrlParameter(); + this.api.XMLHttpGet(parameterList); + } + + private List CreateUrlParameter() { ListPickerItemModel semester = (ListPickerItemModel)this.Semester.SelectedItem; ListPickerItemModel degree = (ListPickerItemModel)this.Degree.SelectedItem; ListPickerItemModel course = (ListPickerItemModel)this.Course.SelectedItem; ListPickerItemModel from = (ListPickerItemModel)this.From.SelectedItem; ListPickerItemModel to = (ListPickerItemModel)this.To.SelectedItem; - Uri request = LectureFeed.CreateFeedUrl(semester.Value, degree.Value, course.Value, from.Value, to.Value); - this.feed = new LectureFeed(request); - this.feed.EventHandler.FeedIsReadyEvent += new FeedEventHandler.FeedReadyHandler(this.FeedIsReady); - this.ProgressBar.Visibility = System.Windows.Visibility.Visible; - this.feed.LoadFeed(); - } + List parameterList = new List(); + parameterList.Add(new UrlParamModel("Semester",semester.Value)); + parameterList.Add(new UrlParamModel("Abschluss", degree.Value)); + parameterList.Add(new UrlParamModel("Studiengang", course.Value)); + parameterList.Add(new UrlParamModel("Von", from.Value)); + parameterList.Add(new UrlParamModel("Bis", to.Value)); + return parameterList; + + } /// /// Method will be execute if the feed is ready /// - private void FeedIsReady() + private void ApiIsReady() { - App.SaveToIsolatedStorage(Constants.IsolatedStorageLectureModel, this.feed.Model); + App.SaveToIsolatedStorage(Constants.IsolatedStorageLectureModel, this.api.Model); this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed; Uri url = new Uri(Constants.PathResultPage, UriKind.Relative); NavigationService.Navigate(url); diff --git a/CampusAppWP8/CampusAppWP8/Properties/WMAppManifest.xml b/CampusAppWP8/CampusAppWP8/Properties/WMAppManifest.xml index f4b319d3..b65e09d5 100644 --- a/CampusAppWP8/CampusAppWP8/Properties/WMAppManifest.xml +++ b/CampusAppWP8/CampusAppWP8/Properties/WMAppManifest.xml @@ -13,7 +13,7 @@ - + diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs index 89fc3666..9171dccc 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs +++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs @@ -123,6 +123,15 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die http://www.zv.tu-cottbus.de/LSFveranst/LSF4 ähnelt. + /// + internal static string UrlLectureApiBaseAddr { + get { + return ResourceManager.GetString("UrlLectureApiBaseAddr", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die https://www.tu-cottbus.de/modul/ ähnelt. /// diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx index 6ec52b15..cbf64ad2 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx +++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx @@ -147,4 +147,7 @@ /Pages/Lecture/ResultPage.xaml + + http://www.zv.tu-cottbus.de/LSFveranst/LSF4 + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Utility/RestApi.cs b/CampusAppWP8/CampusAppWP8/Utility/RestApi.cs index f179c448..1b61a137 100644 --- a/CampusAppWP8/CampusAppWP8/Utility/RestApi.cs +++ b/CampusAppWP8/CampusAppWP8/Utility/RestApi.cs @@ -7,7 +7,9 @@ //----------------------------------------------------------------------using System; namespace CampusAppWP8.Utility { + using CampusAppWP8.Model.Utility; using System; + using System.Collections.Generic; using System.Net; /// @@ -60,6 +62,21 @@ namespace CampusAppWP8.Utility this.client.DownloadStringAsync(url); } + /// + /// Method create the Url for the http-get-method + /// + /// list of parameters + /// + public Uri CreateGetUrl(List parameters) + { + string paramterStr = string.Empty; + foreach(UrlParamModel parameter in parameters){ + paramterStr += parameter.ToString(); + } + string getUrlStr = client.BaseAddress + "?" + paramterStr; + return new Uri(getUrlStr, UriKind.Absolute); + } + /// /// Method realize the http-delete-method /// diff --git a/CampusAppWP8/CampusAppWP8/Utility/XmlApi.cs b/CampusAppWP8/CampusAppWP8/Utility/XmlApi.cs index fc700f3c..64218571 100644 --- a/CampusAppWP8/CampusAppWP8/Utility/XmlApi.cs +++ b/CampusAppWP8/CampusAppWP8/Utility/XmlApi.cs @@ -1,4 +1,5 @@ -using CampusAppWP8.Resources; +using CampusAppWP8.Model.Utility; +using CampusAppWP8.Resources; using System; using System.Collections.Generic; using System.Linq; @@ -76,6 +77,17 @@ namespace CampusAppWP8.Utility } } + + /// + /// Method realize the http-get-method resource + /// + /// Url of the resource + /// callback method + public void XMLHttpGet(List parameters) + { + Uri getUrl = this.CreateGetUrl(parameters); + this.HttpGet(getUrl, this.DownloadCompleted); + } /// /// Method create the model of the feed /// @@ -95,7 +107,7 @@ namespace CampusAppWP8.Utility /// Method implement the deserialization a Xml-feed /// /// content of the feed - protected override void Deserialization(string feedString) + protected void Deserialization(string feedString) { XmlSerializer serializer = new XmlSerializer(typeof(T)); XDocument document = XDocument.Parse(feedString); From 5dbcc01dd2a4bc16ef8e0b815fc78551a5bb1561 Mon Sep 17 00:00:00 2001 From: stubbfel Date: Mon, 17 Jun 2013 13:48:10 +0200 Subject: [PATCH 5/6] add doku + refactor to lectur and api #33 --- .../CampusAppWP8/Feed/Lecture/LectureApi.cs | 9 +- .../Model/Lecture/LectureModule.cs | 2 +- .../Pages/Lecture/LecturePage.xaml | 5 +- .../Pages/Lecture/LecturePage.xaml.cs | 22 +- .../Pages/Lecture/ModulWebPage.xaml.cs | 8 +- .../Pages/Lecture/ResultDetailPage.xaml.cs | 6 +- .../Pages/Lecture/ResultPage.xaml.cs | 6 +- .../Pages/Webmail/WebmailPage.xaml.cs | 2 +- .../Resources/Constants.Designer.cs | 90 ++++++-- .../CampusAppWP8/Resources/Constants.resx | 36 +++- .../CampusAppWP8/Utility/ApiEventHandler.cs | 15 +- CampusAppWP8/CampusAppWP8/Utility/RestApi.cs | 22 +- CampusAppWP8/CampusAppWP8/Utility/XmlApi.cs | 197 +++++++++++------- CampusAppWP8/CampusAppWP8/utility/Feed.cs | 2 +- CampusAppWP8/CampusAppWP8/utility/XMLFeed.cs | 29 ++- 15 files changed, 301 insertions(+), 150 deletions(-) diff --git a/CampusAppWP8/CampusAppWP8/Feed/Lecture/LectureApi.cs b/CampusAppWP8/CampusAppWP8/Feed/Lecture/LectureApi.cs index 3f80c5e2..885c86fc 100644 --- a/CampusAppWP8/CampusAppWP8/Feed/Lecture/LectureApi.cs +++ b/CampusAppWP8/CampusAppWP8/Feed/Lecture/LectureApi.cs @@ -1,5 +1,5 @@ //----------------------------------------------------------------------- -// +// // Company copyright tag. // // stubbfel @@ -9,8 +9,8 @@ namespace CampusAppWP8.Feed.Lecture { using System; using CampusAppWP8.Model.Lecture; - using CampusAppWP8.Utility; using CampusAppWP8.Resources; + using CampusAppWP8.Utility; /// /// Class for the feed of the Lecture @@ -23,11 +23,10 @@ namespace CampusAppWP8.Feed.Lecture /// /// Initializes a new instance of the class. /// - /// the RequestUrl public LectureApi() - : base(new Uri(Constants.UrlLectureApiBaseAddr)) + : base(new Uri(Constants.UrlLecture_ApiBaseAddr)) { - this.validRootName = "lsf_auszug"; + this.ValidRootName = Constants.LectureXmlValidRootName; } } } diff --git a/CampusAppWP8/CampusAppWP8/Model/Lecture/LectureModule.cs b/CampusAppWP8/CampusAppWP8/Model/Lecture/LectureModule.cs index 076407b5..1a190438 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Lecture/LectureModule.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Lecture/LectureModule.cs @@ -90,7 +90,7 @@ namespace CampusAppWP8.Model.Lecture /// private void CreateUrl() { - this.url = new Uri(Constants.UrlLectureModulBaseAddr + this.number.ToString()); + this.url = new Uri(Constants.UrlLecture_ModulBaseAddr + this.number.ToString()); } #endregion diff --git a/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml index 9eeaf42a..db091258 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml @@ -22,12 +22,11 @@ - + - - + diff --git a/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs index 9602344f..44274e0e 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs @@ -24,7 +24,7 @@ namespace CampusAppWP8.Pages.Lecture public partial class LecturePage : PhoneApplicationPage { /// - /// actual LectureFeed + /// actual LectureAPI /// private LectureApi api; @@ -149,6 +149,10 @@ namespace CampusAppWP8.Pages.Lecture this.api.XMLHttpGet(parameterList); } + /// + /// Method read the values from the inputs and put them in a list of parameters + /// + /// a list of parameters private List CreateUrlParameter() { ListPickerItemModel semester = (ListPickerItemModel)this.Semester.SelectedItem; @@ -158,22 +162,22 @@ namespace CampusAppWP8.Pages.Lecture ListPickerItemModel to = (ListPickerItemModel)this.To.SelectedItem; List parameterList = new List(); - parameterList.Add(new UrlParamModel("Semester",semester.Value)); - parameterList.Add(new UrlParamModel("Abschluss", degree.Value)); - parameterList.Add(new UrlParamModel("Studiengang", course.Value)); - parameterList.Add(new UrlParamModel("Von", from.Value)); - parameterList.Add(new UrlParamModel("Bis", to.Value)); + parameterList.Add(new UrlParamModel(Constants.ParamGetLecture_Semester, semester.Value)); + parameterList.Add(new UrlParamModel(Constants.ParamGetLecture_Degree, degree.Value)); + parameterList.Add(new UrlParamModel(Constants.ParamGetLecture_Course, course.Value)); + parameterList.Add(new UrlParamModel(Constants.ParamGetLecture_From, from.Value)); + parameterList.Add(new UrlParamModel(Constants.ParamGetLecture_To, to.Value)); return parameterList; - } + /// /// Method will be execute if the feed is ready /// private void ApiIsReady() { - App.SaveToIsolatedStorage(Constants.IsolatedStorageLectureModel, this.api.Model); + App.SaveToIsolatedStorage(Constants.IsolatedStorage_LectureModel, this.api.Model); this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed; - Uri url = new Uri(Constants.PathResultPage, UriKind.Relative); + Uri url = new Uri(Constants.PathLecture_ResultPage, UriKind.Relative); NavigationService.Navigate(url); } } diff --git a/CampusAppWP8/CampusAppWP8/Pages/Lecture/ModulWebPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Lecture/ModulWebPage.xaml.cs index 989f0b51..cf6d4332 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Lecture/ModulWebPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Lecture/ModulWebPage.xaml.cs @@ -13,7 +13,7 @@ namespace CampusAppWP8.Pages.Lecture using Microsoft.Phone.Controls; /// - /// Class for the page which shows Webpages from the BaseAddress + /// Class for the page which shows Webpages from the BaseAddress /// public partial class ModulWebPage : PhoneApplicationPage { @@ -31,10 +31,10 @@ namespace CampusAppWP8.Pages.Lecture /// Arguments of navigation protected override void OnNavigatedTo(NavigationEventArgs e) { - if (NavigationContext.QueryString.ContainsKey(Constants.ParamLectureModulNumber)) + if (NavigationContext.QueryString.ContainsKey(Constants.ParamModelLecture_ModulNumber)) { - string number = NavigationContext.QueryString[Constants.ParamLectureModulNumber]; - this.WebmailBrowser.Navigate(new Uri(Constants.UrlLectureModulBaseAddr + number, UriKind.Absolute)); + string number = NavigationContext.QueryString[Constants.ParamModelLecture_ModulNumber]; + this.WebmailBrowser.Navigate(new Uri(Constants.UrlLecture_ModulBaseAddr + number, UriKind.Absolute)); } base.OnNavigatedTo(e); diff --git a/CampusAppWP8/CampusAppWP8/Pages/Lecture/ResultDetailPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Lecture/ResultDetailPage.xaml.cs index ad54ee75..e09763e3 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Lecture/ResultDetailPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Lecture/ResultDetailPage.xaml.cs @@ -31,9 +31,9 @@ namespace CampusAppWP8.Pages.Lecture /// Arguments of navigation protected override void OnNavigatedTo(NavigationEventArgs e) { - if (NavigationContext.QueryString.ContainsKey(Constants.ParamLectureActivityId)) + if (NavigationContext.QueryString.ContainsKey(Constants.ParamModelLecture_ActivityId)) { - string activityId = NavigationContext.QueryString[Constants.ParamLectureActivityId]; + string activityId = NavigationContext.QueryString[Constants.ParamModelLecture_ActivityId]; this.LoadActivity(int.Parse(activityId)); } @@ -46,7 +46,7 @@ namespace CampusAppWP8.Pages.Lecture /// id of the activity private void LoadActivity(int activityId) { - LectureList list = App.LoadFromIsolatedStorage(Constants.IsolatedStorageLectureModel); + LectureList list = App.LoadFromIsolatedStorage(Constants.IsolatedStorage_LectureModel); if (list != null) { LectureActivity activity = list.GetActivity(activityId); diff --git a/CampusAppWP8/CampusAppWP8/Pages/Lecture/ResultPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Lecture/ResultPage.xaml.cs index 454b67ea..6486db91 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Lecture/ResultPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Lecture/ResultPage.xaml.cs @@ -39,7 +39,7 @@ namespace CampusAppWP8.Pages.Lecture /// Arguments of navigation protected override void OnNavigatedTo(NavigationEventArgs e) { - LectureList list = App.LoadFromIsolatedStorage(Constants.IsolatedStorageLectureModel); + LectureList list = App.LoadFromIsolatedStorage(Constants.IsolatedStorage_LectureModel); this.ResultList.ItemsSource = list.Activities; base.OnNavigatedTo(e); } @@ -132,7 +132,7 @@ namespace CampusAppWP8.Pages.Lecture private void ShowModulWebPage(object sender, RoutedEventArgs e) { Button btn = (Button)sender; - Uri url = new Uri(Constants.PathLectureModulWebPage + "?" + Constants.ParamLectureModulNumber + "=" + btn.Tag, UriKind.Relative); + Uri url = new Uri(Constants.PathLecture_ModulWebPage + "?" + Constants.ParamModelLecture_ModulNumber + "=" + btn.Tag, UriKind.Relative); NavigationService.Navigate(url); } @@ -144,7 +144,7 @@ namespace CampusAppWP8.Pages.Lecture private void ShowDetailPage(object sender, RoutedEventArgs e) { Button btn = (Button)sender; - Uri url = new Uri(Constants.PathResultDetailPage + "?" + Constants.ParamLectureActivityId + "=" + btn.Tag, UriKind.Relative); + Uri url = new Uri(Constants.PathLecture_ResultDetailPage + "?" + Constants.ParamModelLecture_ActivityId + "=" + btn.Tag, UriKind.Relative); NavigationService.Navigate(url); } } diff --git a/CampusAppWP8/CampusAppWP8/Pages/Webmail/WebmailPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Webmail/WebmailPage.xaml.cs index 22e81f25..50afc636 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Webmail/WebmailPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Webmail/WebmailPage.xaml.cs @@ -30,7 +30,7 @@ namespace CampusAppWP8.Pages.Webmail /// private void LoadWebmailPage() { - this.WebmailBrowser.Navigate(new Uri(Constants.UrlWebMailAddr, UriKind.Absolute)); + this.WebmailBrowser.Navigate(new Uri(Constants.UrlWebMail_Addr, UriKind.Absolute)); } } } \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs index 9171dccc..f6d9df87 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs +++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs @@ -63,27 +63,81 @@ namespace CampusAppWP8.Resources { /// /// Sucht eine lokalisierte Zeichenfolge, die LectureModel ähnelt. /// - internal static string IsolatedStorageLectureModel { + internal static string IsolatedStorage_LectureModel { get { - return ResourceManager.GetString("IsolatedStorageLectureModel", resourceCulture); + return ResourceManager.GetString("IsolatedStorage_LectureModel", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die lsf_auszug ähnelt. + /// + internal static string LectureXmlValidRootName { + get { + return ResourceManager.GetString("LectureXmlValidRootName", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Studiengang ähnelt. + /// + internal static string ParamGetLecture_Course { + get { + return ResourceManager.GetString("ParamGetLecture_Course", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Abschluss ähnelt. + /// + internal static string ParamGetLecture_Degree { + get { + return ResourceManager.GetString("ParamGetLecture_Degree", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Von ähnelt. + /// + internal static string ParamGetLecture_From { + get { + return ResourceManager.GetString("ParamGetLecture_From", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Semester ähnelt. + /// + internal static string ParamGetLecture_Semester { + get { + return ResourceManager.GetString("ParamGetLecture_Semester", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Bis ähnelt. + /// + internal static string ParamGetLecture_To { + get { + return ResourceManager.GetString("ParamGetLecture_To", resourceCulture); } } /// /// Sucht eine lokalisierte Zeichenfolge, die ActivityId ähnelt. /// - internal static string ParamLectureActivityId { + internal static string ParamModelLecture_ActivityId { get { - return ResourceManager.GetString("ParamLectureActivityId", resourceCulture); + return ResourceManager.GetString("ParamModelLecture_ActivityId", resourceCulture); } } /// /// Sucht eine lokalisierte Zeichenfolge, die ModulNumber ähnelt. /// - internal static string ParamLectureModulNumber { + internal static string ParamModelLecture_ModulNumber { get { - return ResourceManager.GetString("ParamLectureModulNumber", resourceCulture); + return ResourceManager.GetString("ParamModelLecture_ModulNumber", resourceCulture); } } @@ -99,54 +153,54 @@ namespace CampusAppWP8.Resources { /// /// Sucht eine lokalisierte Zeichenfolge, die /Pages/Lecture/ModulWebPage.xaml ähnelt. /// - internal static string PathLectureModulWebPage { + internal static string PathLecture_ModulWebPage { get { - return ResourceManager.GetString("PathLectureModulWebPage", resourceCulture); + return ResourceManager.GetString("PathLecture_ModulWebPage", resourceCulture); } } /// /// Sucht eine lokalisierte Zeichenfolge, die /Pages/Lecture/ResultDetailPage.xaml ähnelt. /// - internal static string PathResultDetailPage { + internal static string PathLecture_ResultDetailPage { get { - return ResourceManager.GetString("PathResultDetailPage", resourceCulture); + return ResourceManager.GetString("PathLecture_ResultDetailPage", resourceCulture); } } /// /// Sucht eine lokalisierte Zeichenfolge, die /Pages/Lecture/ResultPage.xaml ähnelt. /// - internal static string PathResultPage { + internal static string PathLecture_ResultPage { get { - return ResourceManager.GetString("PathResultPage", resourceCulture); + return ResourceManager.GetString("PathLecture_ResultPage", resourceCulture); } } /// /// Sucht eine lokalisierte Zeichenfolge, die http://www.zv.tu-cottbus.de/LSFveranst/LSF4 ähnelt. /// - internal static string UrlLectureApiBaseAddr { + internal static string UrlLecture_ApiBaseAddr { get { - return ResourceManager.GetString("UrlLectureApiBaseAddr", resourceCulture); + return ResourceManager.GetString("UrlLecture_ApiBaseAddr", resourceCulture); } } /// /// Sucht eine lokalisierte Zeichenfolge, die https://www.tu-cottbus.de/modul/ ähnelt. /// - internal static string UrlLectureModulBaseAddr { + internal static string UrlLecture_ModulBaseAddr { get { - return ResourceManager.GetString("UrlLectureModulBaseAddr", resourceCulture); + return ResourceManager.GetString("UrlLecture_ModulBaseAddr", resourceCulture); } } /// /// Sucht eine lokalisierte Zeichenfolge, die https://webmail.tu-cottbus.de ähnelt. /// - internal static string UrlWebMailAddr { + internal static string UrlWebMail_Addr { get { - return ResourceManager.GetString("UrlWebMailAddr", resourceCulture); + return ResourceManager.GetString("UrlWebMail_Addr", resourceCulture); } } diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx index cbf64ad2..3549c065 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx +++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx @@ -117,37 +117,55 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + LectureModel - + ActivityId - + ModulNumber Url - + /Pages/Lecture/ModulWebPage.xaml - + /Pages/Lecture/ResultDetailPage.xaml - + https://www.tu-cottbus.de/modul/ root - + https://webmail.tu-cottbus.de - + /Pages/Lecture/ResultPage.xaml - + + lsf_auszug + + + Studiengang + + + Abschluss + + + Von + + + Semester + + + Bis + + http://www.zv.tu-cottbus.de/LSFveranst/LSF4 \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Utility/ApiEventHandler.cs b/CampusAppWP8/CampusAppWP8/Utility/ApiEventHandler.cs index f90b2ec4..ddb1baaa 100644 --- a/CampusAppWP8/CampusAppWP8/Utility/ApiEventHandler.cs +++ b/CampusAppWP8/CampusAppWP8/Utility/ApiEventHandler.cs @@ -1,13 +1,14 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 17.06.2013 +//---------------------------------------------------------------------- namespace CampusAppWP8.Utility { /// - /// This class handle the events of a api + /// This class handle the events of a API /// public class ApiEventHandler { diff --git a/CampusAppWP8/CampusAppWP8/Utility/RestApi.cs b/CampusAppWP8/CampusAppWP8/Utility/RestApi.cs index 1b61a137..6c2283eb 100644 --- a/CampusAppWP8/CampusAppWP8/Utility/RestApi.cs +++ b/CampusAppWP8/CampusAppWP8/Utility/RestApi.cs @@ -7,10 +7,10 @@ //----------------------------------------------------------------------using System; namespace CampusAppWP8.Utility { - using CampusAppWP8.Model.Utility; using System; using System.Collections.Generic; using System.Net; + using CampusAppWP8.Model.Utility; /// /// Class realize the access of restful RestAPI @@ -66,14 +66,16 @@ namespace CampusAppWP8.Utility /// Method create the Url for the http-get-method /// /// list of parameters - /// + /// absolute API-Url include GetParameter public Uri CreateGetUrl(List parameters) { string paramterStr = string.Empty; - foreach(UrlParamModel parameter in parameters){ + foreach (UrlParamModel parameter in parameters) + { paramterStr += parameter.ToString(); } - string getUrlStr = client.BaseAddress + "?" + paramterStr; + + string getUrlStr = this.client.BaseAddress + "?" + paramterStr; return new Uri(getUrlStr, UriKind.Absolute); } @@ -91,7 +93,7 @@ namespace CampusAppWP8.Utility } /// - /// Method realize the http-delete-method + /// Method realize the http-head-method /// /// /// is not supported by WebClient @@ -104,7 +106,7 @@ namespace CampusAppWP8.Utility } /// - /// Method realize the http-delete-method + /// Method realize the http-options-method /// /// /// is not supported by WebClient @@ -117,7 +119,7 @@ namespace CampusAppWP8.Utility } /// - /// Method realize the http-delete-method + /// Method realize the http-connect-method /// /// /// is not supported by WebClient @@ -130,7 +132,7 @@ namespace CampusAppWP8.Utility } /// - /// Method realize the http-delete-method + /// Method realize the http-trace-method /// /// /// is not supported by WebClient @@ -154,7 +156,7 @@ namespace CampusAppWP8.Utility } /// - /// Method realize the http-get-method + /// Method realize the http-put-method /// /// Url of the resource /// callback method @@ -165,7 +167,7 @@ namespace CampusAppWP8.Utility } /// - /// Method realize the http-get-method + /// Method realize the http-patch-method /// /// Url of the resource /// callback method diff --git a/CampusAppWP8/CampusAppWP8/Utility/XmlApi.cs b/CampusAppWP8/CampusAppWP8/Utility/XmlApi.cs index 64218571..df80424a 100644 --- a/CampusAppWP8/CampusAppWP8/Utility/XmlApi.cs +++ b/CampusAppWP8/CampusAppWP8/Utility/XmlApi.cs @@ -1,37 +1,63 @@ -using CampusAppWP8.Model.Utility; -using CampusAppWP8.Resources; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Text; -using System.Threading.Tasks; -using System.Xml.Linq; -using System.Xml.Serialization; - +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 13.06.2013 +//---------------------------------------------------------------------- namespace CampusAppWP8.Utility { - public class XmlApi : RestApi + using System; + using System.Collections.Generic; + using System.Net; + using System.Xml.Linq; + using System.Xml.Serialization; + using CampusAppWP8.Model.Utility; + using CampusAppWP8.Resources; + + /// + /// This abstract Class is for Xml-API + /// + /// Type for model of the API + public abstract class XmlApi : RestApi { - /// - /// The model of the feed - /// - private T model; - - protected string validRootName = Constants.XMLRootElementName; + #region Members /// - /// EventHandler of the api + /// EventHandler of the API /// private readonly ApiEventHandler eventHandler; - public XmlApi(Uri apiBaseAddress): base(apiBaseAddress) + /// + /// The model of the API + /// + private T model; + + /// + /// Variable for the name of the root-tag + /// + private string validRootName = Constants.XMLRootElementName; + + #endregion + + #region Constructor + + /// + /// Initializes a new instance of the class. + /// + /// BaseUrl of the API + public XmlApi(Uri apiBaseAddress) + : base(apiBaseAddress) { this.eventHandler = new ApiEventHandler(); } + #endregion + + #region Proberty + /// - /// Gets or sets for the model of the feed + /// Gets or sets for the model of the API /// public T Model { @@ -50,7 +76,7 @@ namespace CampusAppWP8.Utility } /// - /// Gets for the event-handler of the feed + /// Gets for the event-handler of the API /// public ApiEventHandler EventHandler { @@ -58,11 +84,84 @@ namespace CampusAppWP8.Utility } /// - /// Method will be execute if the download of the feed is completed and create the model + /// Gets or sets the ValidRootName of the API + /// + protected string ValidRootName + { + get + { + return this.validRootName; + } + + set + { + if (value != this.validRootName) + { + this.validRootName = value; + } + } + } + + #endregion + + #region Methods + #region public + + /// + /// Method send an HTTP-Get for an Xml-API + /// + /// list of GetParameter + public void XMLHttpGet(List parameters) + { + Uri getUrl = this.CreateGetUrl(parameters); + this.HttpGet(getUrl, this.DownloadCompleted); + } + + /// + /// Method create the model of the API + /// + /// content of the API + private void CreateModel(string xmlString) + { + if (xmlString == null || xmlString == string.Empty) + { + return; + } + + this.Deserialization(xmlString); + this.EventHandler.FireApiReadyevent(); + } + #endregion + + #region private + /// + /// Method implement the deserialization a Xml-API + /// + /// content of the API + private void Deserialization(string xmlString) + { + XmlSerializer serializer = new XmlSerializer(typeof(T)); + XDocument document = XDocument.Parse(xmlString); + if (!document.Root.Name.ToString().Equals(this.ValidRootName)) + { + XElement content = document.Root; + document = new XDocument(); + document.Add(new XElement(this.ValidRootName, content)); + } + + T model = (T)serializer.Deserialize(document.CreateReader()); + if (model != null) + { + this.Model = model; + } + } + + /// + /// Method will be execute if the download of the API is completed and create the model /// /// Sender of the event /// Arguments of the event - public void DownloadCompleted(object sender, DownloadStringCompletedEventArgs e) + private void DownloadCompleted(object sender, DownloadStringCompletedEventArgs e) { Exception downloadError = e.Error; if (downloadError != null) @@ -76,53 +175,7 @@ namespace CampusAppWP8.Utility this.CreateModel(downloadResult); } } - - - /// - /// Method realize the http-get-method resource - /// - /// Url of the resource - /// callback method - public void XMLHttpGet(List parameters) - { - Uri getUrl = this.CreateGetUrl(parameters); - this.HttpGet(getUrl, this.DownloadCompleted); - } - /// - /// Method create the model of the feed - /// - /// content of the feed - private void CreateModel(string xmlString) - { - if (xmlString == null || xmlString == string.Empty) - { - return; - } - - this.Deserialization(xmlString); - this.EventHandler.FireApiReadyevent(); - } - - /// - /// Method implement the deserialization a Xml-feed - /// - /// content of the feed - protected void Deserialization(string feedString) - { - XmlSerializer serializer = new XmlSerializer(typeof(T)); - XDocument document = XDocument.Parse(feedString); - if (!document.Root.Name.ToString().Equals(validRootName)) - { - XElement content = document.Root; - document = new XDocument(); - document.Add(new XElement(validRootName, content)); - } - - T model = (T)serializer.Deserialize(document.CreateReader()); - if (model != null) - { - this.Model = model; - } - } + #endregion + #endregion } } diff --git a/CampusAppWP8/CampusAppWP8/utility/Feed.cs b/CampusAppWP8/CampusAppWP8/utility/Feed.cs index 456ad521..a085617b 100644 --- a/CampusAppWP8/CampusAppWP8/utility/Feed.cs +++ b/CampusAppWP8/CampusAppWP8/utility/Feed.cs @@ -14,7 +14,7 @@ namespace CampusAppWP8.Utility /// This a abstract Class for reading, store and deserialization Feeds from the Web. /// /// Type for model of the feed - public abstract class Feed:RestApi + public abstract class Feed : RestApi { #region Member diff --git a/CampusAppWP8/CampusAppWP8/utility/XMLFeed.cs b/CampusAppWP8/CampusAppWP8/utility/XMLFeed.cs index 6efa3610..c94a9775 100644 --- a/CampusAppWP8/CampusAppWP8/utility/XMLFeed.cs +++ b/CampusAppWP8/CampusAppWP8/utility/XMLFeed.cs @@ -19,9 +19,9 @@ namespace CampusAppWP8.Utility public abstract class XmlFeed : Feed { /// - /// Variablo for the name of the roottag + /// Variable for the name of the root-tag /// - protected string validRootName = Constants.XMLRootElementName; + private string validRootName = Constants.XMLRootElementName; #region Constructor @@ -43,6 +43,27 @@ namespace CampusAppWP8.Utility } #endregion + #region Proberty + /// + /// Gets or sets the ValidRootName of the feed + /// + protected string ValidRootName + { + get + { + return this.validRootName; + } + + set + { + if (value != this.validRootName) + { + this.validRootName = value; + } + } + } + #endregion + #region Methods /// @@ -53,11 +74,11 @@ namespace CampusAppWP8.Utility { XmlSerializer serializer = new XmlSerializer(typeof(T)); XDocument document = XDocument.Parse(feedString); - if (!document.Root.Name.ToString().Equals(validRootName)) + if (!document.Root.Name.ToString().Equals(this.ValidRootName)) { XElement content = document.Root; document = new XDocument(); - document.Add(new XElement(validRootName, content)); + document.Add(new XElement(this.ValidRootName, content)); } T model = (T)serializer.Deserialize(document.CreateReader()); From 7e2552a8e3700c6b6ec3bf6e279ebccaa0a9652f Mon Sep 17 00:00:00 2001 From: stubbfel Date: Mon, 17 Jun 2013 14:03:29 +0200 Subject: [PATCH 6/6] add search button to lecturepage --- CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml | 2 +- CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs | 6 ++++++ CampusAppWP8/CampusAppWP8/Properties/WMAppManifest.xml | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml index db091258..d42a5df4 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml @@ -159,7 +159,7 @@ diff --git a/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs index 44274e0e..2ba1e36c 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs @@ -17,6 +17,8 @@ namespace CampusAppWP8.Pages.Lecture using CampusAppWP8.Resources; using CampusAppWP8.Utility; using Microsoft.Phone.Controls; + using System.Windows.Media; + using System.Windows.Media.Imaging; /// /// Class for the LecturePage @@ -118,6 +120,10 @@ namespace CampusAppWP8.Pages.Lecture { this.InitializeComponent(); this.SetupListPickers(); + if ((Visibility)Application.Current.Resources["PhoneDarkThemeVisibility"] == Visibility.Visible) + { + this.SearchButtonImg.Source = new BitmapImage(new Uri("/Assets/icons/search_159_dark.png",UriKind.Relative)); + } } /// diff --git a/CampusAppWP8/CampusAppWP8/Properties/WMAppManifest.xml b/CampusAppWP8/CampusAppWP8/Properties/WMAppManifest.xml index b65e09d5..f4b319d3 100644 --- a/CampusAppWP8/CampusAppWP8/Properties/WMAppManifest.xml +++ b/CampusAppWP8/CampusAppWP8/Properties/WMAppManifest.xml @@ -13,7 +13,7 @@ - +