finish #121
This commit is contained in:
@@ -12,6 +12,7 @@ namespace CampusAppWP8.Feed.Link
|
||||
using CampusAppWP8.Model;
|
||||
using CampusAppWP8.Model.Link;
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWP8.Utility;
|
||||
|
||||
/// <summary>
|
||||
/// This Class is for ClubLinkFeeds
|
||||
@@ -26,8 +27,9 @@ namespace CampusAppWP8.Feed.Link
|
||||
public ClubLinkFeed()
|
||||
: base(ModelType.FileAndFeed, Constants.FileLink_ClubLinks, Constants.UrlLink_ClubLinks)
|
||||
{
|
||||
this.isFileUpToDate += new IsFileUpToDate(this.CheckIsFileUpToDate);
|
||||
this.isModelUpToDate += new IsModelUpToDate(this.CheckIsModelUpToDate);
|
||||
this.isFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDateOnLoad);
|
||||
this.isFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDateOnSave);
|
||||
this.isModelUpToDateOnLoad += new IsModelUpToDate(this.CheckIsModelUpToDate);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -58,12 +60,31 @@ namespace CampusAppWP8.Feed.Link
|
||||
/// <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)
|
||||
private bool CheckIsFileUpToDateOnLoad(LinkListModel model, FileInfo fileInfo)
|
||||
{
|
||||
DateTime lastModified = fileInfo.LastWriteTime;
|
||||
return this.CheckIsUpToDate(lastModified);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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 CheckIsFileUpToDateOnSave(LinkListModel model, FileInfo fileInfo)
|
||||
{
|
||||
bool retValue = true;
|
||||
|
||||
if ((fileInfo.Exists == false)
|
||||
|| (fileInfo.Length == 0))
|
||||
{
|
||||
retValue = false;
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if the model or file is up-to-date.
|
||||
/// </summary>
|
||||
@@ -71,16 +92,7 @@ namespace CampusAppWP8.Feed.Link
|
||||
/// <returns>true, if is up-to-date, otherwise false</returns>
|
||||
private bool CheckIsUpToDate(DateTime lastModified)
|
||||
{
|
||||
DateTime temp = lastModified.AddDays(1);
|
||||
|
||||
int diff = temp.CompareTo(DateTime.Now);
|
||||
|
||||
if (diff < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return Utilities.DayDifference(Utilities.DifferenceType.Less, lastModified, 7.0);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace CampusAppWP8.Feed.Link
|
||||
using CampusAppWP8.Model;
|
||||
using CampusAppWP8.Model.Link;
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWP8.Utility;
|
||||
|
||||
/// <summary>
|
||||
/// This Class is for CommonLinkFeeds
|
||||
@@ -26,8 +27,9 @@ namespace CampusAppWP8.Feed.Link
|
||||
public CommonLinkFeed()
|
||||
: base(ModelType.FileAndFeed, Constants.FileLink_CommonLinks, Constants.UrlLink_CommonLinks)
|
||||
{
|
||||
this.isFileUpToDate += new IsFileUpToDate(this.CheckIsFileUpToDate);
|
||||
this.isModelUpToDate += new IsModelUpToDate(this.CheckIsModelUpToDate);
|
||||
this.isFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDateOnLoad);
|
||||
this.isFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDateOnSave);
|
||||
this.isModelUpToDateOnLoad += new IsModelUpToDate(this.CheckIsModelUpToDate);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -58,7 +60,26 @@ namespace CampusAppWP8.Feed.Link
|
||||
/// <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)
|
||||
private bool CheckIsFileUpToDateOnSave(LinkListModel model, FileInfo fileInfo)
|
||||
{
|
||||
bool retValue = true;
|
||||
|
||||
if ((fileInfo.Exists == false)
|
||||
|| (fileInfo.Length == 0))
|
||||
{
|
||||
retValue = false;
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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 CheckIsFileUpToDateOnLoad(LinkListModel model, FileInfo fileInfo)
|
||||
{
|
||||
DateTime lastModified = fileInfo.LastWriteTime;
|
||||
return this.CheckIsUpToDate(lastModified);
|
||||
@@ -71,16 +92,7 @@ namespace CampusAppWP8.Feed.Link
|
||||
/// <returns>true, if is up-to-date, otherwise false</returns>
|
||||
private bool CheckIsUpToDate(DateTime lastModified)
|
||||
{
|
||||
DateTime temp = lastModified.AddDays(1);
|
||||
|
||||
int diff = temp.CompareTo(DateTime.Now);
|
||||
|
||||
if (diff < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return Utilities.DayDifference(Utilities.DifferenceType.Less, lastModified, 7.0);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace CampusAppWP8.Feed.Mensa
|
||||
using CampusAppWP8.Model;
|
||||
using CampusAppWP8.Model.Mensa;
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWP8.Utility;
|
||||
|
||||
/// <summary>
|
||||
/// This Class is for MensaFeeds
|
||||
@@ -26,8 +27,9 @@ namespace CampusAppWP8.Feed.Mensa
|
||||
public MensaFeed()
|
||||
: base(ModelType.FileAndFeed, Constants.FileMensa_Shedule, Constants.UrlMensa_Week)
|
||||
{
|
||||
this.isFileUpToDate += new IsFileUpToDate(this.CheckIsFileUpToDate);
|
||||
this.isModelUpToDate += new IsModelUpToDate(this.CheckIsModelUpToDate);
|
||||
this.isFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDateOnLoad);
|
||||
this.isFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDateOnSave);
|
||||
this.isModelUpToDateOnLoad += new IsModelUpToDate(this.CheckIsModelUpToDate);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -58,12 +60,31 @@ namespace CampusAppWP8.Feed.Mensa
|
||||
/// <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)
|
||||
private bool CheckIsFileUpToDateOnLoad(MenuWeekModel model, FileInfo fileInfo)
|
||||
{
|
||||
DateTime lastModified = fileInfo.LastWriteTime;
|
||||
return this.CheckIsUpToDate(lastModified);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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 CheckIsFileUpToDateOnSave(MenuWeekModel model, FileInfo fileInfo)
|
||||
{
|
||||
bool retValue = true;
|
||||
|
||||
if ((fileInfo.Exists == false)
|
||||
|| (fileInfo.Length == 0))
|
||||
{
|
||||
retValue = false;
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method check if the last modification was later as the NewMenuWeekDay
|
||||
/// </summary>
|
||||
@@ -81,6 +102,7 @@ namespace CampusAppWP8.Feed.Mensa
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace CampusAppWP8.Feed.StudentCouncil
|
||||
using CampusAppWP8.Model;
|
||||
using CampusAppWP8.Model.StudentCouncil;
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWP8.Utility;
|
||||
|
||||
/// <summary>
|
||||
/// This Class is for StudentCouncilFeed
|
||||
@@ -26,8 +27,9 @@ namespace CampusAppWP8.Feed.StudentCouncil
|
||||
public StudentCouncilFeed()
|
||||
: base(ModelType.FileAndFeed, Constants.FileStudentCouncil_StudentCouncils, Constants.UrlStudentCouncil_StudentCouncils)
|
||||
{
|
||||
this.isFileUpToDate += new IsFileUpToDate(this.CheckIsFileUpToDate);
|
||||
this.isModelUpToDate += new IsModelUpToDate(this.CheckIsModelUpToDate);
|
||||
this.isFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDateOnLoad);
|
||||
this.isFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDateOnSave);
|
||||
this.isModelUpToDateOnLoad += new IsModelUpToDate(this.CheckIsModelUpToDate);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -58,12 +60,30 @@ namespace CampusAppWP8.Feed.StudentCouncil
|
||||
/// <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(StudentCouncilListModel model, FileInfo fileInfo)
|
||||
private bool CheckIsFileUpToDateOnLoad(StudentCouncilListModel model, FileInfo fileInfo)
|
||||
{
|
||||
DateTime lastModified = fileInfo.LastWriteTime;
|
||||
return this.CheckIsUpToDate(lastModified);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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 CheckIsFileUpToDateOnSave(StudentCouncilListModel model, FileInfo fileInfo)
|
||||
{
|
||||
bool retValue = true;
|
||||
|
||||
if ((fileInfo.Exists == false)
|
||||
|| (fileInfo.Length == 0))
|
||||
{
|
||||
retValue = false;
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
/// <summary>
|
||||
/// Check if the model or file is up-to-date.
|
||||
/// </summary>
|
||||
@@ -71,16 +91,7 @@ namespace CampusAppWP8.Feed.StudentCouncil
|
||||
/// <returns>true, if is up-to-date, otherwise false</returns>
|
||||
private bool CheckIsUpToDate(DateTime lastModified)
|
||||
{
|
||||
DateTime temp = lastModified.AddDays(1);
|
||||
|
||||
int diff = temp.CompareTo(DateTime.Now);
|
||||
|
||||
if (diff < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return Utilities.DayDifference(Utilities.DifferenceType.Less, lastModified, 7.0);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -115,6 +115,7 @@ namespace CampusAppWP8.Pages.Links
|
||||
{
|
||||
this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed;
|
||||
}
|
||||
this.commonLinkFeed.SaveData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -128,6 +129,7 @@ namespace CampusAppWP8.Pages.Links
|
||||
{
|
||||
this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed;
|
||||
}
|
||||
this.clubLinkFeed.SaveData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -88,6 +88,7 @@ namespace CampusAppWP8.Pages.Mensa
|
||||
{
|
||||
this.SetupMensaPivot();
|
||||
this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed;
|
||||
this.feed.SaveData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -83,6 +83,7 @@ namespace CampusAppWP8.Pages.Openinghours
|
||||
{
|
||||
this.SetupInstitutionList();
|
||||
this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed;
|
||||
this.feed.SaveData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -77,6 +77,7 @@ namespace CampusAppWP8.Pages.StudentCouncil
|
||||
{
|
||||
this.SetupStudentCouncilPivot();
|
||||
this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed;
|
||||
this.feed.SaveData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user