change to XMLModel
This commit is contained in:
@@ -11,6 +11,7 @@ namespace CampusAppWP8.Feed.Lecture
|
||||
using CampusAppWP8.Model.Lecture;
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWP8.Utility;
|
||||
using CampusAppWP8.Model;
|
||||
|
||||
/// <summary>
|
||||
/// Class for the feed of the Lecture
|
||||
@@ -18,13 +19,13 @@ namespace CampusAppWP8.Feed.Lecture
|
||||
/// <remarks>
|
||||
/// need the XmlAPI
|
||||
/// </remarks>
|
||||
public class LectureApi : XmlApi<LectureList>
|
||||
public class LectureApi : XmlModel<LectureList>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="LectureApi" /> class.
|
||||
/// </summary>
|
||||
public LectureApi()
|
||||
: base(new Uri(Constants.UrlLecture_ApiBaseAddr))
|
||||
: base(ModelType.Feed, Constants.UrlLecture_ApiBaseAddr)
|
||||
{
|
||||
this.ValidRootName = Constants.LectureXmlValidRootName;
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ namespace CampusAppWP8.Model
|
||||
public XmlModel(ModelType modelType, string fileName, string url)
|
||||
: base(modelType, fileName, url)
|
||||
{
|
||||
this.ValidRootName = Constants.XMLRootElementName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -39,6 +40,11 @@ namespace CampusAppWP8.Model
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets for the name of the root-tag
|
||||
/// </summary>
|
||||
protected string ValidRootName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Create the model from a xml byte array.
|
||||
/// </summary>
|
||||
@@ -50,7 +56,7 @@ namespace CampusAppWP8.Model
|
||||
|
||||
string data = Encoding.UTF8.GetString(modelData, 0, modelData.Length);
|
||||
|
||||
T tempModel = XmlManager.DeserializationToModel<T>(data, Constants.XMLRootElementName);
|
||||
T tempModel = XmlManager.DeserializationToModel<T>(data, this.ValidRootName);
|
||||
if (tempModel != null)
|
||||
{
|
||||
this.Model = tempModel;
|
||||
|
||||
@@ -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<UrlParamModel> parameterList = this.CreateUrlParameter();
|
||||
this.api.ApiGet(parameterList);
|
||||
this.api.SetUriParams(parameterList);
|
||||
this.api.LoadData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user