add getLoadmodus

This commit is contained in:
stubbfel
2013-08-27 11:23:07 +02:00
parent 870b5314ab
commit c1eadc2452
14 changed files with 69 additions and 12 deletions

View File

@@ -483,6 +483,9 @@
<ItemGroup>
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
</ItemGroup>
<ItemGroup>
<Folder Include="Feed\Utility\" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)\Microsoft.$(TargetFrameworkIdentifier).$(TargetFrameworkVersion).Overrides.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)\Microsoft.$(TargetFrameworkIdentifier).CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

View File

@@ -62,7 +62,7 @@ namespace CampusAppWP8.Feed.Link
/// <returns>true, if file is up-to-date, otherwise false</returns>
private bool CheckIsFileUpToDate(LinkListModel model, FileInfo fileInfo)
{
if (fileInfo == null || !fileInfo.Exists)
if (fileInfo == null || !fileInfo.Exists || fileInfo.Length < 1)
{
return false;
}

View File

@@ -62,7 +62,7 @@ namespace CampusAppWP8.Feed.Link
/// <returns>true, if file is up-to-date, otherwise false</returns>
private bool CheckIsFileUpToDate(LinkListModel model, FileInfo fileInfo)
{
if (fileInfo == null || !fileInfo.Exists)
if (fileInfo == null || !fileInfo.Exists || fileInfo.Length < 1)
{
return false;
}

View File

@@ -96,7 +96,7 @@ namespace CampusAppWP8.Feed.Mensa
/// <returns>true, if file is up-to-date, otherwise false</returns>
private bool CheckIsFileUpToDate(MenuWeekModel model, FileInfo fileInfo)
{
if (fileInfo == null || !fileInfo.Exists)
if (fileInfo == null || !fileInfo.Exists || fileInfo.Length < 1)
{
return false;
}

View File

@@ -62,7 +62,7 @@ namespace CampusAppWP8.Feed.StudentCouncil
/// <returns>true, if file is up-to-date, otherwise false</returns>
private bool CheckIsFileUpToDate(StudentCouncilListModel model, FileInfo fileInfo)
{
if (fileInfo == null || !fileInfo.Exists)
if (fileInfo == null || !fileInfo.Exists || fileInfo.Length < 1)
{
return false;
}

View File

@@ -15,6 +15,7 @@ namespace CampusAppWP8.Pages.Departments
using CampusAppWP8.Resources;
using CampusAppWP8.Utility.Lui.MessageBoxes;
using Microsoft.Phone.Controls;
using CampusAppWP8.Utility;
/// <summary>
/// Page with a list of the faculties.
@@ -48,7 +49,8 @@ namespace CampusAppWP8.Pages.Departments
DepartmentIndexPage.feed.OnLoaded += new DepartmentFeed.OnIO(this.SetupFacultyList);
DepartmentIndexPage.feed.OnFailedWeb += new DepartmentFeed.OnFailed(this.FeedIsFailedWeb);
DepartmentIndexPage.feed.OnFailedFile += new DepartmentFeed.OnFailed(this.FeedIsFailedFile);
DepartmentIndexPage.feed.LoadData();
DepartmentIndexPage.feed.LoadData(Utilities.getLoadModus<Model.Departments.DepartmentModel>());
if (DepartmentIndexPage.favorite == null)
{

View File

@@ -12,6 +12,7 @@ namespace CampusAppWP8.Pages.Events
using System.Windows.Navigation;
using CampusAppWP8.Feed.Events;
using CampusAppWP8.Resources;
using CampusAppWP8.Utility;
using CampusAppWP8.Utility.Lui.MessageBoxes;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
@@ -48,7 +49,7 @@ namespace CampusAppWP8.Pages.Events
EventIndexPage.eventFeed.OnLoaded += new EventFeed.OnIO(this.SetupEventPageList);
EventIndexPage.eventFeed.OnFailedWeb += new EventFeed.OnFailed(this.FeedIsFailedWeb);
EventIndexPage.eventFeed.OnFailedFile += new EventFeed.OnFailed(this.FeedIsFailedFile);
EventIndexPage.eventFeed.LoadData();
EventIndexPage.eventFeed.LoadData(Utilities.getLoadModus<Model.RSS.RSSViewModel>());
}
/// <summary>
@@ -88,6 +89,21 @@ namespace CampusAppWP8.Pages.Events
base.OnNavigatedTo(e);
}
/// <summary>
/// Methods overrides the OnNavigatedFrom-Method
/// </summary>
/// <param name="e">some NavigationEventArgs</param>
protected override void OnNavigatedFrom(NavigationEventArgs e)
{
if (NavigationMode.Back == e.NavigationMode)
{
// delete all models
EventIndexPage.eventFeed.SaveData();
}
base.OnNavigatedFrom(e);
}
/// <summary>
/// Is called after the RSS feeds are loaded into the eventFeed model.
/// If there was no feed information set to the UI, the feed list

View File

@@ -63,6 +63,7 @@ namespace CampusAppWP8.Pages.Lecture
#region methods
#region protected
/// <summary>
/// Methods overrides the OnNavigatedFrom-Method
/// </summary>

View File

@@ -14,6 +14,7 @@ namespace CampusAppWP8.Pages.Links
using CampusAppWP8.Resources;
using CampusAppWP8.Utility.Lui.MessageBoxes;
using Microsoft.Phone.Controls;
using CampusAppWP8.Utility;
/// <summary>
/// Class for the LinkPage
@@ -66,8 +67,8 @@ namespace CampusAppWP8.Pages.Links
this.InitializeFeeds();
this.ProgressBar.Visibility = System.Windows.Visibility.Visible;
this.loadingFeeds = 2;
this.commonLinkFeed.LoadData();
this.clubLinkFeed.LoadData();
this.commonLinkFeed.LoadData(Utilities.getLoadModus<Model.Link.LinkListModel>());
this.clubLinkFeed.LoadData(Utilities.getLoadModus<Model.Link.LinkListModel>());
}
/// <summary>

View File

@@ -17,6 +17,7 @@ namespace CampusAppWP8.Pages.Mensa
using CampusAppWP8.Utility.Lui.MessageBoxes;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using CampusAppWP8.Utility;
/// <summary>
/// Class for the MensaPage
@@ -176,7 +177,7 @@ namespace CampusAppWP8.Pages.Mensa
}
else
{
this.feed.LoadData();
this.feed.LoadData(Utilities.getLoadModus<Model.Mensa.MenuWeekModel>());
}
}

View File

@@ -15,6 +15,7 @@ namespace CampusAppWP8.Pages.News
using CampusAppWP8.Utility.Lui.MessageBoxes;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using CampusAppWP8.Utility;
/// <summary>
/// Overview page of all news.
@@ -48,7 +49,7 @@ namespace CampusAppWP8.Pages.News
NewsIndexPage.newsFeed.OnLoaded += new NewsFeed.OnIO(this.SetupNewsPageList);
NewsIndexPage.newsFeed.OnFailedWeb += new NewsFeed.OnFailed(this.FeedIsFailWeb);
NewsIndexPage.newsFeed.OnFailedFile += new NewsFeed.OnFailed(this.FeedIsFailFile);
NewsIndexPage.newsFeed.LoadData();
NewsIndexPage.newsFeed.LoadData(Utilities.getLoadModus<Model.RSS.RSSViewModel>());
}
/// <summary>
@@ -88,6 +89,20 @@ namespace CampusAppWP8.Pages.News
base.OnNavigatedTo(e);
}
/// <summary>
/// Methods overrides the OnNavigatedFrom-Method
/// </summary>
/// <param name="e">some NavigationEventArgs</param>
protected override void OnNavigatedFrom(NavigationEventArgs e)
{
if (NavigationMode.Back == e.NavigationMode)
{
// delete all models
NewsIndexPage.newsFeed.SaveData();
}
base.OnNavigatedFrom(e);
}
/// <summary>
/// Is called after the RSS feeds are loaded into the newsFeed model.
/// If there was no feed information set to the UI, the feed list

View File

@@ -15,6 +15,7 @@ namespace CampusAppWP8.Pages.Openinghours
using CampusAppWP8.Resources;
using CampusAppWP8.Utility.Lui.MessageBoxes;
using Microsoft.Phone.Controls;
using CampusAppWP8.Utility;
/// <summary>
/// Opening hours page.
@@ -51,7 +52,7 @@ namespace CampusAppWP8.Pages.Openinghours
this.feed.OnLoaded += new OpeninghoursFeed.OnIO(this.FeedIsReady);
this.feed.OnFailedWeb += new OpeninghoursFeed.OnFailed(this.FeedIsFailedWeb);
this.feed.OnFailedFile += new OpeninghoursFeed.OnFailed(this.FeedIsFailedFile);
this.feed.LoadData();
this.feed.LoadData(Utilities.getLoadModus<Model.Openinghours.OpeninghoursModel>());
}
this.isNewInstance = true;

View File

@@ -14,6 +14,7 @@ namespace CampusAppWP8.Pages.StudentCouncil
using CampusAppWP8.Resources;
using CampusAppWP8.Utility.Lui.MessageBoxes;
using Microsoft.Phone.Controls;
using CampusAppWP8.Utility;
/// <summary>
/// Class for the StudentCouncilPage
@@ -59,7 +60,7 @@ namespace CampusAppWP8.Pages.StudentCouncil
}
this.ProgressBar.Visibility = System.Windows.Visibility.Visible;
this.feed.LoadData();
this.feed.LoadData(Utilities.getLoadModus<Model.StudentCouncil.StudentCouncilListModel>());
}
/// <summary>

View File

@@ -322,5 +322,21 @@ namespace CampusAppWP8.Utility
}
return false;
}
/// <summary>Gets load modus. Is check if the only Wifi option is active</summary>
/// <remarks>Stubbfel, 27.08.2013.</remarks>
/// <typeparam name="T">Generic type parameter.</typeparam>
/// <returns>The load modus&lt; t&gt;</returns>
public static MainModel<T>.ForceType getLoadModus<T>()
{
if (Settings.AppSetting.OnlyWifi && !Settings.AppSetting.WifiEnable)
{
return MainModel<T>.ForceType.FORCE_FILE;
}
else
{
return MainModel<T>.ForceType.INVALID;
}
}
}
}