add onfailing to all pages which use MainModel

This commit is contained in:
stubbfel
2013-08-15 13:52:13 +02:00
parent af62e79351
commit 38fbbfe053
8 changed files with 170 additions and 14 deletions

View File

@@ -13,6 +13,7 @@ namespace CampusAppWP8.Pages.Departments
using System.Windows.Navigation;
using CampusAppWP8.Feed.Departments;
using CampusAppWP8.Resources;
using CampusAppWP8.Utility.Lui.MessageBoxes;
using Microsoft.Phone.Controls;
/// <summary>
@@ -44,6 +45,8 @@ namespace CampusAppWP8.Pages.Departments
}
DepartmentIndexPage.feed.onLoaded += new DepartmentFeed.OnLoaded(this.SetupFacultyList);
DepartmentIndexPage.feed.onFailedWeb += new DepartmentFeed.OnFailed(this.FeedIsFailWeb);
DepartmentIndexPage.feed.onFailedFile += new DepartmentFeed.OnFailed(this.FeedIsFailFile);
DepartmentIndexPage.feed.LoadData();
if (DepartmentIndexPage.favorite == null)
@@ -52,6 +55,7 @@ namespace CampusAppWP8.Pages.Departments
}
DepartmentIndexPage.favorite.onLoaded += new DepartmentFavoriteFeed.OnLoaded(this.CheckFavoriteFeed);
DepartmentIndexPage.favorite.onFailedFile += new DepartmentFavoriteFeed.OnFailed(this.FeedIsFailFile);
DepartmentIndexPage.favorite.LoadData();
}
@@ -205,5 +209,22 @@ namespace CampusAppWP8.Pages.Departments
{
DepartmentIndexPage.feed.ForceWebUpdate();
}
/// <summary>
/// Method will be execute if the feed is failed
/// </summary>
private void FeedIsFailWeb()
{
MessageBoxResult result = MessageBoxes.ShowMainModelErrorMessageBox(AppResources.MsgBox_ErrorMainModelLoadWeb);
DepartmentIndexPage.feed.ForceReadFile();
}
/// <summary>
/// Method will be execute if the feed is failed
/// </summary>
private void FeedIsFailFile()
{
MessageBoxResult result = MessageBoxes.ShowMainModelErrorMessageBox(AppResources.MsgBox_ErrorMainModelLoadFile);
}
}
}

View File

@@ -8,9 +8,11 @@
namespace CampusAppWP8.Pages.Events
{
using System;
using System.Windows;
using System.Windows.Navigation;
using CampusAppWP8.Feed.Events;
using CampusAppWP8.Resources;
using CampusAppWP8.Utility.Lui.MessageBoxes;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
@@ -43,6 +45,8 @@ namespace CampusAppWP8.Pages.Events
}
EventIndexPage.eventFeed.onLoaded += new EventFeed.OnLoaded(this.SetupEventPageList);
EventIndexPage.eventFeed.onFailedWeb += new EventFeed.OnFailed(this.FeedIsFailWeb);
EventIndexPage.eventFeed.onFailedFile += new EventFeed.OnFailed(this.FeedIsFailFile);
EventIndexPage.eventFeed.LoadData();
}
@@ -103,5 +107,22 @@ namespace CampusAppWP8.Pages.Events
{
EventIndexPage.eventFeed.ForceWebUpdate();
}
/// <summary>
/// Method will be execute if the feed is failed
/// </summary>
private void FeedIsFailWeb()
{
MessageBoxResult result = MessageBoxes.ShowMainModelErrorMessageBox(AppResources.MsgBox_ErrorMainModelLoadWeb);
EventIndexPage.eventFeed.ForceReadFile();
}
/// <summary>
/// Method will be execute if the feed is failed
/// </summary>
private void FeedIsFailFile()
{
MessageBoxResult result = MessageBoxes.ShowMainModelErrorMessageBox(AppResources.MsgBox_ErrorMainModelLoadFile);
}
}
}

View File

@@ -15,6 +15,7 @@ namespace CampusAppWP8.Pages.Lecture
using CampusAppWP8.Model.Lecture;
using CampusAppWP8.Model.Utility;
using CampusAppWP8.Resources;
using CampusAppWP8.Utility.Lui.MessageBoxes;
using Microsoft.Phone.Controls;
/// <summary>
@@ -166,6 +167,7 @@ namespace CampusAppWP8.Pages.Lecture
{
this.api = new LectureApi();
this.api.onLoaded += new LectureApi.OnLoaded(this.ApiIsReady);
this.api.onFailed += new LectureApi.OnFailed(this.ApiIsFail);
this.ProgressBar.Visibility = System.Windows.Visibility.Visible;
List<UrlParamModel> parameterList = this.CreateUrlParameter();
this.api.SetUriParams(parameterList);
@@ -239,6 +241,15 @@ namespace CampusAppWP8.Pages.Lecture
this.To.ItemsSource = this.pageModel.ToNumberList.List;
}
/// <summary>
/// Method will be execute if the feed is failed
/// </summary>
private void ApiIsFail()
{
MessageBoxResult result = MessageBoxes.ShowMainModelErrorMessageBox(AppResources.MsgBox_ErrorMainModelLoad);
this.ProgressBar.Visibility = Visibility.Collapsed;
}
#endregion
#endregion

View File

@@ -8,8 +8,11 @@
namespace CampusAppWP8.Pages.Links
{
using System;
using System.Windows;
using System.Windows.Navigation;
using CampusAppWP8.Feed.Link;
using CampusAppWP8.Resources;
using CampusAppWP8.Utility.Lui.MessageBoxes;
using Microsoft.Phone.Controls;
/// <summary>
@@ -103,6 +106,8 @@ namespace CampusAppWP8.Pages.Links
{
this.commonLinkFeed = new CommonLinkFeed();
this.commonLinkFeed.onLoaded += new CommonLinkFeed.OnLoaded(this.CommonLinkFeedIsReady);
this.commonLinkFeed.onFailedWeb += new CommonLinkFeed.OnFailed(this.CommonLinkFeedIsFailWeb);
this.commonLinkFeed.onFailedFile += new CommonLinkFeed.OnFailed(this.FeedIsFailFile);
}
/// <summary>
@@ -112,6 +117,8 @@ namespace CampusAppWP8.Pages.Links
{
this.clubLinkFeed = new ClubLinkFeed();
this.clubLinkFeed.onLoaded += new ClubLinkFeed.OnLoaded(this.ClubLinkFeedIsReady);
this.clubLinkFeed.onFailedWeb += new ClubLinkFeed.OnFailed(this.ClubLinkFeedIsFailWeb);
this.clubLinkFeed.onFailedFile += new ClubLinkFeed.OnFailed(this.FeedIsFailFile);
}
/// <summary>
@@ -120,12 +127,7 @@ namespace CampusAppWP8.Pages.Links
private void CommonLinkFeedIsReady()
{
this.SetupCommonPivot();
this.loadingFeeds--;
if (this.loadingFeeds < 1)
{
this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed;
}
this.SetupProgressBarVisibilityCollapsed();
}
/// <summary>
@@ -134,11 +136,7 @@ namespace CampusAppWP8.Pages.Links
private void ClubLinkFeedIsReady()
{
this.SetupClubPivot();
this.loadingFeeds--;
if (this.loadingFeeds < 1)
{
this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed;
}
this.SetupProgressBarVisibilityCollapsed();
}
/// <summary>
@@ -170,6 +168,45 @@ namespace CampusAppWP8.Pages.Links
this.commonLinkFeed.ForceWebUpdate();
this.clubLinkFeed.ForceWebUpdate();
}
/// <summary>
/// Method will be execute if the feed is failed
/// </summary>
private void ClubLinkFeedIsFailWeb()
{
MessageBoxResult result = MessageBoxes.ShowMainModelErrorMessageBox(AppResources.MsgBox_ErrorMainModelLoadWeb);
this.clubLinkFeed.ForceReadFile();
}
/// <summary>
/// Method will be execute if the feed is failed
/// </summary>
private void CommonLinkFeedIsFailWeb()
{
MessageBoxResult result = MessageBoxes.ShowMainModelErrorMessageBox(AppResources.MsgBox_ErrorMainModelLoadWeb);
this.commonLinkFeed.ForceReadFile();
}
/// <summary>
/// Method will be execute if the feed is failed
/// </summary>
private void FeedIsFailFile()
{
MessageBoxResult result = MessageBoxes.ShowMainModelErrorMessageBox(AppResources.MsgBox_ErrorMainModelLoadFile);
this.SetupProgressBarVisibilityCollapsed();
}
/// <summary>
/// Method set the visibility of the ProgressBar to Collapsed if loadingFeeds less then 1
/// </summary>
private void SetupProgressBarVisibilityCollapsed()
{
this.loadingFeeds--;
if (this.loadingFeeds < 1)
{
this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed;
}
}
#endregion
#endregion

View File

@@ -132,6 +132,7 @@ namespace CampusAppWP8.Pages.Mensa
this.feed = MensaFeed.CreateCampusMensaFeed(campus);
this.feed.onLoaded += new MensaFeed.OnLoaded(this.FeedIsReady);
this.feed.onFailedWeb += new MensaFeed.OnFailed(this.FeedIsFailWeb);
this.feed.onFailedFile += new MensaFeed.OnFailed(this.FeedIsFailFile);
this.CalcSelectedIndex();
if (this.forceLoad)

View File

@@ -8,9 +8,11 @@
namespace CampusAppWP8.Pages.News
{
using System;
using System.Windows;
using System.Windows.Navigation;
using CampusAppWP8.Feed.News;
using CampusAppWP8.Resources;
using CampusAppWP8.Utility.Lui.MessageBoxes;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
@@ -43,6 +45,8 @@ namespace CampusAppWP8.Pages.News
}
NewsIndexPage.newsFeed.onLoaded += new NewsFeed.OnLoaded(this.SetupNewsPageList);
NewsIndexPage.newsFeed.onFailedWeb += new NewsFeed.OnFailed(this.FeedIsFailWeb);
NewsIndexPage.newsFeed.onFailedFile += new NewsFeed.OnFailed(this.FeedIsFailFile);
NewsIndexPage.newsFeed.LoadData();
}
@@ -103,5 +107,22 @@ namespace CampusAppWP8.Pages.News
{
NewsIndexPage.newsFeed.ForceWebUpdate();
}
/// <summary>
/// Method will be execute if the feed is failed
/// </summary>
private void FeedIsFailWeb()
{
MessageBoxResult result = MessageBoxes.ShowMainModelErrorMessageBox(AppResources.MsgBox_ErrorMainModelLoadWeb);
NewsIndexPage.newsFeed.ForceReadFile();
}
/// <summary>
/// Method will be execute if the feed is failed
/// </summary>
private void FeedIsFailFile()
{
MessageBoxResult result = MessageBoxes.ShowMainModelErrorMessageBox(AppResources.MsgBox_ErrorMainModelLoadFile);
}
}
}

View File

@@ -8,10 +8,12 @@
namespace CampusAppWP8.Pages.Openinghours
{
using System;
using System.Windows;
using System.Windows.Navigation;
using CampusAppWP8.Feed.Openinghours;
using CampusAppWP8.Model.Openinghours;
using CampusAppWP8.Resources;
using CampusAppWP8.Utility.Lui.MessageBoxes;
using Microsoft.Phone.Controls;
/// <summary>
@@ -46,6 +48,8 @@ namespace CampusAppWP8.Pages.Openinghours
{
this.feed = new OpeninghoursFeed();
this.feed.onLoaded += new OpeninghoursFeed.OnLoaded(this.FeedIsReady);
this.feed.onFailedWeb += new OpeninghoursFeed.OnFailed(this.FeedIsFailWeb);
this.feed.onFailedFile += new OpeninghoursFeed.OnFailed(this.FeedIsFailFile);
this.feed.LoadData();
}
@@ -130,6 +134,23 @@ namespace CampusAppWP8.Pages.Openinghours
this.feed.ForceWebUpdate();
}
/// <summary>
/// Method will be execute if the feed is failed
/// </summary>
private void FeedIsFailWeb()
{
MessageBoxResult result = MessageBoxes.ShowMainModelErrorMessageBox(AppResources.MsgBox_ErrorMainModelLoadWeb);
this.feed.ForceReadFile();
}
/// <summary>
/// Method will be execute if the feed is failed
/// </summary>
private void FeedIsFailFile()
{
MessageBoxResult result = MessageBoxes.ShowMainModelErrorMessageBox(AppResources.MsgBox_ErrorMainModelLoadFile);
}
// private
#endregion

View File

@@ -7,10 +7,13 @@
//----------------------------------------------------------------------
namespace CampusAppWP8.Pages.StudentCouncil
{
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using CampusAppWP8.Feed.StudentCouncil;
using System;
using System.Windows;
using System.Windows.Navigation;
using CampusAppWP8.Feed.StudentCouncil;
using CampusAppWP8.Resources;
using CampusAppWP8.Utility.Lui.MessageBoxes;
using Microsoft.Phone.Controls;
/// <summary>
/// Class for the StudentCouncilPage
@@ -78,6 +81,8 @@ namespace CampusAppWP8.Pages.StudentCouncil
{
this.feed = new StudentCouncilFeed();
this.feed.onLoaded += new StudentCouncilFeed.OnLoaded(this.FeedIsReady);
this.feed.onFailedWeb += new StudentCouncilFeed.OnFailed(this.FeedIsFailWeb);
this.feed.onFailedFile += new StudentCouncilFeed.OnFailed(this.FeedIsFailFile);
}
/// <summary>
@@ -109,6 +114,24 @@ namespace CampusAppWP8.Pages.StudentCouncil
this.feed.ForceWebUpdate();
}
/// <summary>
/// Method will be execute if the feed is failed
/// </summary>
private void FeedIsFailWeb()
{
MessageBoxResult result = MessageBoxes.ShowMainModelErrorMessageBox(AppResources.MsgBox_ErrorMainModelLoadWeb);
this.feed.ForceReadFile();
}
/// <summary>
/// Method will be execute if the feed is failed
/// </summary>
private void FeedIsFailFile()
{
MessageBoxResult result = MessageBoxes.ShowMainModelErrorMessageBox(AppResources.MsgBox_ErrorMainModelLoadFile);
this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed;
}
#endregion
#endregion