diff --git a/CampusAppWP8/CampusAppWP8/Api/Lecture/LectureApi.cs b/CampusAppWP8/CampusAppWP8/Api/Lecture/LectureApi.cs index 885c86fc..ddcf309d 100644 --- a/CampusAppWP8/CampusAppWP8/Api/Lecture/LectureApi.cs +++ b/CampusAppWP8/CampusAppWP8/Api/Lecture/LectureApi.cs @@ -11,6 +11,7 @@ namespace CampusAppWP8.Feed.Lecture using CampusAppWP8.Model.Lecture; using CampusAppWP8.Resources; using CampusAppWP8.Utility; + using CampusAppWP8.Model; /// /// Class for the feed of the Lecture @@ -18,13 +19,13 @@ namespace CampusAppWP8.Feed.Lecture /// /// need the XmlAPI /// - public class LectureApi : XmlApi + public class LectureApi : XmlModel { /// /// Initializes a new instance of the class. /// public LectureApi() - : base(new Uri(Constants.UrlLecture_ApiBaseAddr)) + : base(ModelType.Feed, Constants.UrlLecture_ApiBaseAddr) { this.ValidRootName = Constants.LectureXmlValidRootName; } diff --git a/CampusAppWP8/CampusAppWP8/Model/XmlModel.cs b/CampusAppWP8/CampusAppWP8/Model/XmlModel.cs index 7803e0e8..ffb56040 100644 --- a/CampusAppWP8/CampusAppWP8/Model/XmlModel.cs +++ b/CampusAppWP8/CampusAppWP8/Model/XmlModel.cs @@ -26,6 +26,7 @@ namespace CampusAppWP8.Model public XmlModel(ModelType modelType, string fileName, string url) : base(modelType, fileName, url) { + this.ValidRootName = Constants.XMLRootElementName; } /// @@ -39,6 +40,11 @@ namespace CampusAppWP8.Model { } + /// + /// Gets or sets for the name of the root-tag + /// + protected string ValidRootName { get; set; } + /// /// Create the model from a xml byte array. /// @@ -50,7 +56,7 @@ namespace CampusAppWP8.Model string data = Encoding.UTF8.GetString(modelData, 0, modelData.Length); - T tempModel = XmlManager.DeserializationToModel(data, Constants.XMLRootElementName); + T tempModel = XmlManager.DeserializationToModel(data, this.ValidRootName); if (tempModel != null) { this.Model = tempModel; diff --git a/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs index 8afc016e..37f46e87 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs @@ -167,10 +167,11 @@ namespace CampusAppWP8.Pages.Lecture private void SendRequest(object sender, RoutedEventArgs e) { this.api = new LectureApi(); - this.api.EventHandler.ApiIsReadyEvent += new ApiEventHandler.ApiReadyHandler(this.ApiIsReady); + this.api.onLoaded += new LectureApi.OnLoaded(this.ApiIsReady); this.ProgressBar.Visibility = System.Windows.Visibility.Visible; List parameterList = this.CreateUrlParameter(); - this.api.ApiGet(parameterList); + this.api.SetUriParams(parameterList); + this.api.LoadData(); } ///