change to XMLModel

This commit is contained in:
stubbfel
2013-07-16 11:59:38 +02:00
parent 182b50eca2
commit 347e45f561
5 changed files with 48 additions and 43 deletions

View File

@@ -34,11 +34,12 @@ namespace CampusAppWP8.Feed.Link
#region Method
#region Protected
#region Private
/// <summary>
/// Method implement CheckIsModelUpToDate()-Method <see cref="Pages"/>.
/// Method check if the FeedModel is up-to-date
/// </summary>
/// <param name="model">reference of the FeedModel</param>
/// <returns>true, if model is up-to-date, otherwise false</returns>
private bool CheckIsModelUpToDate(LinkListModel model)
{
@@ -46,22 +47,22 @@ namespace CampusAppWP8.Feed.Link
{
return false;
}
DateTime lastModified = model.CreateTime;
return this.CheckIsUpToDate(lastModified);
}
/// <summary>
/// Method implement CheckIsFileUpToDate()-Method <see cref="Pages"/>.
/// Method check if the FeedFile is up-to-date
/// </summary>
/// <param name="model">reference of the FeedModel</param>
/// <param name="fileInfo">info about the file</param>
/// <returns>true, if file is up-to-date, otherwise false</returns>
private bool CheckIsFileUpToDate(LinkListModel model, FileInfo fileInfo)
{
DateTime lastModified = fileInfo.LastWriteTime;
return this.CheckIsUpToDate(lastModified);
}
#endregion
#region Private
/// <summary>
/// Check if the model or file is up-to-date.

View File

@@ -8,11 +8,10 @@
namespace CampusAppWP8.Feed.Link
{
using System;
using System.IO;
using CampusAppWP8.Model;
using CampusAppWP8.Model.Link;
using CampusAppWP8.Resources;
using CampusAppWP8.Utility;
using CampusAppWP8.Model;
using System.IO;
/// <summary>
/// This Class is for CommonLinkFeeds
@@ -35,11 +34,12 @@ namespace CampusAppWP8.Feed.Link
#region Method
#region Protected
#region Private
/// <summary>
/// Method implement CheckIsModelUpToDate()-Method <see cref="Pages"/>.
/// Method check if the FeedModel is up-to-date
/// </summary>
/// <param name="model">reference of the FeedModel</param>
/// <returns>true, if model is up-to-date, otherwise false</returns>
private bool CheckIsModelUpToDate(LinkListModel model)
{
@@ -47,13 +47,16 @@ namespace CampusAppWP8.Feed.Link
{
return false;
}
DateTime lastModified = model.CreateTime;
return this.CheckIsUpToDate(lastModified);
}
/// <summary>
/// Method implement CheckIsFileUpToDate()-Method <see cref="Pages"/>.
/// Method check if the FeedFile is up-to-date
/// </summary>
/// <param name="model">reference of the FeedModel</param>
/// <param name="fileInfo">info about the file</param>
/// <returns>true, if file is up-to-date, otherwise false</returns>
private bool CheckIsFileUpToDate(LinkListModel model, FileInfo fileInfo)
{
@@ -61,10 +64,6 @@ namespace CampusAppWP8.Feed.Link
return this.CheckIsUpToDate(lastModified);
}
#endregion
#region Private
/// <summary>
/// Check if the model or file is up-to-date.
/// </summary>

View File

@@ -8,12 +8,10 @@
namespace CampusAppWP8.Api.Mensa
{
using System;
using System.Collections.ObjectModel;
using CampusAppWP8.Model.Mensa;
using CampusAppWP8.Utility;
using CampusAppWP8.Model;
using CampusAppWP8.Resources;
using System.IO;
using CampusAppWP8.Model;
using CampusAppWP8.Model.Mensa;
using CampusAppWP8.Resources;
/// <summary>
/// This Class is for MensaFeeds
@@ -36,11 +34,12 @@ namespace CampusAppWP8.Api.Mensa
#region Method
#region Protected
#region Private
/// <summary>
/// Method implement CheckIsModelUpToDate()-Method <see cref="Pages"/>
/// Method check if the FeedModel is up-to-date
/// </summary>
/// <param name="model">reference of the FeedModel</param>
/// <returns>true, if model is up-to-date, otherwise false</returns>
private bool CheckIsModelUpToDate(MenuWeekModel model)
{
@@ -48,13 +47,16 @@ namespace CampusAppWP8.Api.Mensa
{
return false;
}
DateTime lastModified = model.CreateTime;
return this.CheckIsUpToDate(lastModified);
}
/// <summary>
/// Method implement CheckIsFileUpToDate()-Method <see cref="Pages"/>
/// Method check if the FeedFile is up-to-date
/// </summary>
/// <param name="model">reference of the FeedModel</param>
/// <param name="fileInfo">info about the file</param>
/// <returns>true, if file is up-to-date, otherwise false</returns>
private bool CheckIsFileUpToDate(MenuWeekModel model, FileInfo fileInfo)
{
@@ -62,10 +64,6 @@ namespace CampusAppWP8.Api.Mensa
return this.CheckIsUpToDate(lastModified);
}
#endregion
#region Private
/// <summary>
/// Method check if the last modification was later as the NewMenuWeekDay
/// </summary>

View File

@@ -8,14 +8,15 @@
namespace CampusAppWP8.Feed.StudentCouncil
{
using System;
using System.IO;
using CampusAppWP8.Model;
using CampusAppWP8.Model.StudentCouncil;
using CampusAppWP8.Resources;
using CampusAppWP8.Utility;
/// <summary>
/// This Class is for StudentCouncilFeed
/// </summary>
public class StudentCouncilFeed : XmlFeed<StudentCouncilListModel>
public class StudentCouncilFeed : XmlModel<StudentCouncilListModel>
{
#region Constructor
@@ -23,40 +24,46 @@ namespace CampusAppWP8.Feed.StudentCouncil
/// Initializes a new instance of the <see cref="StudentCouncilFeed" /> class.
/// </summary>
public StudentCouncilFeed()
: base(new Uri(Constants.UrlStudentCouncil_StudentCouncils, UriKind.Absolute), Constants.FileStudentCouncil_StudentCouncils)
: base(ModelType.FileAndFeed, Constants.FileStudentCouncil_StudentCouncils, Constants.UrlStudentCouncil_StudentCouncils)
{
this.isFileUpToDate += new IsFileUpToDate(this.CheckIsFileUpToDate);
this.isModelUpToDate += new IsModelUpToDate(this.CheckIsModelUpToDate);
}
#endregion
#region Method
#region Protected
#region Private
/// <summary>
/// Method implement CheckIsModelUpToDate()-Method <see cref="Pages"/>.
/// Method check if the FeedModel is up-to-date
/// </summary>
/// <param name="model">reference of the FeedModel</param>
/// <returns>true, if model is up-to-date, otherwise false</returns>
protected override bool CheckIsModelUpToDate()
private bool CheckIsModelUpToDate(StudentCouncilListModel model)
{
if (model == null)
{
return false;
}
DateTime lastModified = this.Model.CreateTime;
return this.CheckIsUpToDate(lastModified);
}
/// <summary>
/// Method implement CheckIsFileUpToDate()-Method <see cref="Pages"/>.
/// Method check if the FeedFile is up-to-date
/// </summary>
/// <param name="model">reference of the FeedModel</param>
/// <param name="fileInfo">info about the file</param>
/// <returns>true, if file is up-to-date, otherwise false</returns>
protected override bool CheckIsFileUpToDate()
private bool CheckIsFileUpToDate(StudentCouncilListModel model, FileInfo fileInfo)
{
DateTime lastModified = FileManager.GetFileInfo(FileName).LastWriteTime;
DateTime lastModified = fileInfo.LastWriteTime;
return this.CheckIsUpToDate(lastModified);
}
#endregion
#region Private
/// <summary>
/// Check if the model or file is up-to-date.
/// </summary>

View File

@@ -61,7 +61,7 @@ namespace CampusAppWP8.Pages.StudentCouncil
}
this.ProgressBar.Visibility = System.Windows.Visibility.Visible;
this.feed.LoadFeed();
this.feed.LoadData();
}
#endregion
@@ -73,7 +73,7 @@ namespace CampusAppWP8.Pages.StudentCouncil
private void InitializeFeed()
{
this.feed = new StudentCouncilFeed();
this.feed.EventHandler.FeedIsReadyEvent += new FeedEventHandler.FeedReadyHandler(this.FeedIsReady);
this.feed.onLoaded += new StudentCouncilFeed.OnLoaded(this.FeedIsReady);
}
/// <summary>