diff --git a/CampusAppWP8/CampusAppWP8/Feed/Departments/DepartmentFavoriteFeed.cs b/CampusAppWP8/CampusAppWP8/Feed/Departments/DepartmentFavoriteFeed.cs
index bdd59d24..053ad487 100644
--- a/CampusAppWP8/CampusAppWP8/Feed/Departments/DepartmentFavoriteFeed.cs
+++ b/CampusAppWP8/CampusAppWP8/Feed/Departments/DepartmentFavoriteFeed.cs
@@ -28,7 +28,8 @@ namespace CampusAppWP8.Feed.Departments
public DepartmentFavoriteFeed(bool autoLoad = true)
: base(ModelType.File, Constants.FileDepartment_Favorite_Name, string.Empty)
{
- this.isFileUpToDate += new IsFileUpToDate(this.CheckIsFileUpToDate);
+ this.isFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDateOnLoad);
+ this.isFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDateOnSave);
if (autoLoad == true)
{
@@ -68,7 +69,7 @@ namespace CampusAppWP8.Feed.Departments
/// model object
/// file info object
/// true, if file is up-to-date, otherwise false
- private bool CheckIsFileUpToDate(DepartmentModel model, FileInfo info)
+ private bool CheckIsFileUpToDateOnLoad(DepartmentModel model, FileInfo info)
{
bool retValue = false;
@@ -76,11 +77,22 @@ namespace CampusAppWP8.Feed.Departments
{
retValue = true;
}
- else
- {
- retValue = (model.HasChanged() == false) ? true : false;
- }
+
+ return retValue;
+ }
+ ///
+ /// Method implement CheckIsFileUpToDate()-Method .
+ ///
+ /// model object
+ /// file info object
+ /// true, if file is up-to-date, otherwise false
+ private bool CheckIsFileUpToDateOnSave(DepartmentModel model, FileInfo info)
+ {
+ bool retValue = false;
+
+ retValue = (model.HasChanged() == false) ? true : false;
+
return retValue;
}
diff --git a/CampusAppWP8/CampusAppWP8/Feed/Departments/DepartmentFeed.cs b/CampusAppWP8/CampusAppWP8/Feed/Departments/DepartmentFeed.cs
index e967ec95..93e71301 100644
--- a/CampusAppWP8/CampusAppWP8/Feed/Departments/DepartmentFeed.cs
+++ b/CampusAppWP8/CampusAppWP8/Feed/Departments/DepartmentFeed.cs
@@ -27,8 +27,9 @@ namespace CampusAppWP8.Feed.Departments
public DepartmentFeed(bool autoLoad = true)
: base(ModelType.FileAndFeed, Constants.FileDepartment_Name, Constants.UrlDepartment_Addr)
{
- 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);
if (autoLoad == true)
{
@@ -70,7 +71,7 @@ namespace CampusAppWP8.Feed.Departments
/// model object
/// file info object
/// true, if file is up-to-date, otherwise false
- private bool CheckIsFileUpToDate(DepartmentModel model, FileInfo info)
+ private bool CheckIsFileUpToDateOnLoad(DepartmentModel model, FileInfo info)
{
bool retValue = true;
@@ -82,19 +83,30 @@ namespace CampusAppWP8.Feed.Departments
retValue = Utilities.DayDifference(Utilities.DifferenceType.Less, info.LastWriteTime, 7.0);
}
}
- else
- {
- // at saving
- if ((info.Exists == false)
- || (info.Length == 0))
- {
- retValue = false;
- }
- }
return retValue;
}
+ ///
+ /// Method implement CheckIsFileUpToDate()-Method .
+ ///
+ /// model object
+ /// file info object
+ /// true, if file is up-to-date, otherwise false
+ private bool CheckIsFileUpToDateOnSave(DepartmentModel model, FileInfo info)
+ {
+ bool retValue = true;
+
+ // at saving
+ if ((info.Exists == false)
+ || (info.Length == 0))
+ {
+ retValue = false;
+ }
+
+ return retValue;
+ }
+
// Protedted
#endregion
diff --git a/CampusAppWP8/CampusAppWP8/Feed/Events/EventFeed.cs b/CampusAppWP8/CampusAppWP8/Feed/Events/EventFeed.cs
index 099c8571..3151e488 100644
--- a/CampusAppWP8/CampusAppWP8/Feed/Events/EventFeed.cs
+++ b/CampusAppWP8/CampusAppWP8/Feed/Events/EventFeed.cs
@@ -25,8 +25,9 @@ namespace CampusAppWP8.Feed.Events
public EventFeed(bool autoLoad = true)
: base(ModelType.FileAndFeed, Constants.FileEvents_Name, Constants.UrlEvents_Addr)
{
- 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);
if (autoLoad == true)
{
@@ -61,7 +62,7 @@ namespace CampusAppWP8.Feed.Events
/// model object
/// file info object
/// true, if file is up-to-date, otherwise false
- private bool CheckIsFileUpToDate(RSSViewModel model, FileInfo info)
+ private bool CheckIsFileUpToDateOnLoad(RSSViewModel model, FileInfo info)
{
bool retValue = true;
@@ -73,16 +74,26 @@ namespace CampusAppWP8.Feed.Events
retValue = Utilities.DayDifference(Utilities.DifferenceType.Less, info.LastWriteTime, 1.0);
}
}
- else
- {
- // at saving
- if ((info.Exists == false)
- || (info.Length == 0))
- {
- retValue = false;
- }
- }
+
+ return retValue;
+ }
+ ///
+ /// Method implement CheckIsFileUpToDate()-Method
+ ///
+ /// model object
+ /// file info object
+ /// true, if file is up-to-date, otherwise false
+ private bool CheckIsFileUpToDateOnSave(RSSViewModel model, FileInfo info)
+ {
+ bool retValue = true;
+
+ if ((info.Exists == false)
+ || (info.Length == 0))
+ {
+ retValue = false;
+ }
+
return retValue;
}
}
diff --git a/CampusAppWP8/CampusAppWP8/Feed/News/NewsFeed.cs b/CampusAppWP8/CampusAppWP8/Feed/News/NewsFeed.cs
index d6cd0411..b194b720 100644
--- a/CampusAppWP8/CampusAppWP8/Feed/News/NewsFeed.cs
+++ b/CampusAppWP8/CampusAppWP8/Feed/News/NewsFeed.cs
@@ -25,8 +25,9 @@ namespace CampusAppWP8.Feed.News
public NewsFeed(bool autoLoad = true)
: base(ModelType.FileAndFeed, Constants.FileNews_Name, Constants.UrlNews_Addr)
{
- 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);
if (autoLoad == true)
{
@@ -61,28 +62,37 @@ namespace CampusAppWP8.Feed.News
/// model object
/// info object of the file
/// true, if file is up-to-date, otherwise false
- private bool CheckIsFileUpToDate(RSSViewModel model, FileInfo info)
+ private bool CheckIsFileUpToDateOnLoad(RSSViewModel model, FileInfo info)
{
bool retValue = true;
if (model == null)
{
- // at loading
if (info.Exists == true)
{
retValue = Utilities.DayDifference(Utilities.DifferenceType.Less, info.LastWriteTime, 1.0);
}
}
- else
- {
- // at saving
- if ((info.Exists == false)
- || (info.Length == 0))
- {
- retValue = false;
- }
- }
+
+ return retValue;
+ }
+
+ ///
+ /// Method implement CheckIsFileUpToDate()-Method
+ ///
+ /// model object
+ /// info object of the file
+ /// true, if file is up-to-date, otherwise false
+ private bool CheckIsFileUpToDateOnSave(RSSViewModel model, FileInfo info)
+ {
+ bool retValue = true;
+ if ((info.Exists == false)
+ || (info.Length == 0))
+ {
+ retValue = false;
+ }
+
return retValue;
}
}
diff --git a/CampusAppWP8/CampusAppWP8/Feed/Openinghours/OpeninghoursFeed.cs b/CampusAppWP8/CampusAppWP8/Feed/Openinghours/OpeninghoursFeed.cs
index d1b0fb71..ae754db0 100644
--- a/CampusAppWP8/CampusAppWP8/Feed/Openinghours/OpeninghoursFeed.cs
+++ b/CampusAppWP8/CampusAppWP8/Feed/Openinghours/OpeninghoursFeed.cs
@@ -12,7 +12,8 @@ namespace CampusAppWP8.Feed.Openinghours
using CampusAppWP8.Model;
using CampusAppWP8.Model.Openinghours;
using CampusAppWP8.Resources;
-
+ using CampusAppWP8.Utility;
+
///
/// This Class is for MesaFeeds
///
@@ -26,8 +27,9 @@ namespace CampusAppWP8.Feed.Openinghours
public OpeninghoursFeed()
: base(ModelType.FileAndFeed, Constants.FileOpeningHours_OpeningHours, Constants.UrlOpeningHours_OpeningHours)
{
- 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
@@ -43,35 +45,58 @@ namespace CampusAppWP8.Feed.Openinghours
/// true, if model is up-to-date, otherwise false
private bool CheckIsModelUpToDate(OpeninghoursModel model)
{
+ bool retValue = true;
+
if (model == null)
{
- return false;
+ retValue = false;
+ }
+ else
+ {
+ retValue = Utilities.DayDifference(Utilities.DifferenceType.Less, model.CreateTime, 7.0);
}
- DateTime lastModified = model.CreateTime;
- return this.CheckIsUpToDate(lastModified);
+ return retValue;
}
///
/// Method check if the FeedFile is up-to-date
///
/// reference of the FeedModel
- /// info about the file
+ /// info about the file
/// true, if file is up-to-date, otherwise false
- private bool CheckIsFileUpToDate(OpeninghoursModel model, FileInfo fileInfo)
+ private bool CheckIsFileUpToDateOnLoad(OpeninghoursModel model, FileInfo info)
{
- DateTime lastModified = fileInfo.LastWriteTime;
- return this.CheckIsUpToDate(lastModified);
+ bool retValue = true;
+
+ if (model == null)
+ {
+ if (info.Exists == true)
+ {
+ retValue = Utilities.DayDifference(Utilities.DifferenceType.Less, info.LastWriteTime, 7.0);
+ }
+ }
+
+ return retValue;
}
///
- /// Check if the model or file is up-to-date.
+ /// Method check if the FeedFile is up-to-date
///
- /// Date of the last modification
- /// true, if is up-to-date, otherwise false
- private bool CheckIsUpToDate(DateTime lastModified)
+ /// reference of the FeedModel
+ /// info about the file
+ /// true, if file is up-to-date, otherwise false
+ private bool CheckIsFileUpToDateOnSave(OpeninghoursModel model, FileInfo info)
{
- return true;
+ bool retValue = true;
+
+ if ((info.Exists == false)
+ || (info.Length == 0))
+ {
+ retValue = false;
+ }
+
+ return retValue;
}
#endregion
diff --git a/CampusAppWP8/CampusAppWP8/Model/MainModel.cs b/CampusAppWP8/CampusAppWP8/Model/MainModel.cs
index c37f74cb..ca175cbc 100644
--- a/CampusAppWP8/CampusAppWP8/Model/MainModel.cs
+++ b/CampusAppWP8/CampusAppWP8/Model/MainModel.cs
@@ -143,14 +143,25 @@ namespace CampusAppWP8
public event OnSaved onSaved = null;
///
- /// Callback pointer, for checking if file is up to date.
+ /// Callback pointer, for checking if file is up to date at loading.
///
- public event IsFileUpToDate isFileUpToDate = null;
+ public event IsFileUpToDate isFileUpToDateOnLoad = null;
///
- /// Callback pointer, for checking if model is up to date.
+ /// Callback pointer, for checking if file is up to date at saving.
///
- public event IsModelUpToDate isModelUpToDate = null;
+ public event IsFileUpToDate isFileUpToDateOnSave = null;
+
+ ///
+ /// Callback pointer, for checking if model is up to date at loading.
+ ///
+ public event IsModelUpToDate isModelUpToDateOnLoad = null;
+
+ ///
+ /// Callback pointer, for checking if model is up to date at saving.
+ /// (currently unused)
+ ///
+ public event IsModelUpToDate isModelUpToDateOnSave = null;
///
/// Specifies the I/O type of the model.
@@ -231,8 +242,8 @@ namespace CampusAppWP8
this.onLoading();
}
- if (((this.isModelUpToDate == null)
- || (this.isModelUpToDate(this.model) == false))
+ if (((this.isModelUpToDateOnLoad == null)
+ || (this.isModelUpToDateOnLoad(this.model) == false))
&& ((this.file != null) || this.api != null))
{
if (this.file != null)
@@ -243,8 +254,8 @@ namespace CampusAppWP8
loadFromFile = false;
}
- if (((this.isFileUpToDate != null) && (this.isFileUpToDate(this.model, this.file.GetFileInfo()) == false))
- || (this.isFileUpToDate == null))
+ if (((this.isFileUpToDateOnLoad != null) && (this.isFileUpToDateOnLoad(this.model, this.file.GetFileInfo()) == false))
+ || (this.isFileUpToDateOnLoad == null))
{
loadFromFile = false;
}
@@ -289,7 +300,7 @@ namespace CampusAppWP8
public void SaveData()
{
if ((this.file != null)
- && ((this.isFileUpToDate == null) || (this.isFileUpToDate(this.model, this.file.GetFileInfo()) == false)))
+ && ((this.isFileUpToDateOnSave == null) || (this.isFileUpToDateOnSave(this.model, this.file.GetFileInfo()) == false)))
{
if (this.onSaving != null)
{