add loading thread to exam page

This commit is contained in:
stubbfel
2013-10-14 17:23:54 +02:00
parent 1aaa934b0e
commit 87fc91073a

View File

@@ -16,6 +16,8 @@ namespace CampusAppWP8.Pages.Exams
using CampusAppWP8.Utility;
using CampusAppWP8.Utility.Lui.MessageBoxes;
using Microsoft.Phone.Controls;
using System.Threading;
using System;
/// <summary>class of ExamsPage.</summary>
/// <remarks>Stubbfel, 02.09.2013.</remarks>
@@ -63,7 +65,9 @@ namespace CampusAppWP8.Pages.Exams
this.InitializeFeed();
}
this.feed.LoadData(Utilities.GetLoadModus<Model.Exams.ExamListWp8Model>());
Thread thread = new Thread(new ThreadStart(this.LoadingFeed));
thread.Start();
}
/// <summary>
@@ -88,6 +92,14 @@ namespace CampusAppWP8.Pages.Exams
#region private
/// <summary> Loading feed. </summary>
/// <remarks> Stubbfel, 14.10.2013. </remarks>
private void LoadingFeed()
{
this.feed.LoadData(Utilities.GetLoadModus<Model.Exams.ExamListWp8Model>());
}
/// <summary>Method initialize the Feed.</summary>
/// <remarks>Stubbfel, 02.09.2013.</remarks>
private void InitializeFeed()
@@ -102,8 +114,17 @@ namespace CampusAppWP8.Pages.Exams
/// <remarks>Stubbfel, 02.09.2013.</remarks>
private void FeedIsReady()
{
this.SetupExamList();
this.DefHeader.ProgressVisibility = Visibility.Collapsed;
if (this.Dispatcher != null)
{
this.Dispatcher.BeginInvoke(new Action(() => this.SetupExamList()));
this.Dispatcher.BeginInvoke(new Action(() => this.DefHeader.ProgressVisibility = Visibility.Collapsed));
}
else
{
this.SetupExamList();
this.DefHeader.ProgressVisibility = Visibility.Collapsed;
}
}
/// <summary>Executes the PDF reader operation.</summary>
@@ -173,7 +194,14 @@ namespace CampusAppWP8.Pages.Exams
/// <remarks>Stubbfel, 02.09.2013.</remarks>
private void FeedIsFailWeb()
{
MessageBoxResult result = MessageBoxes.ShowMainModelErrorMessageBox(AppResources.MsgBox_ErrorMainModelLoadWeb);
if (this.Dispatcher != null)
{
this.Dispatcher.BeginInvoke(new Action(() => MessageBoxes.ShowMainModelErrorMessageBox(AppResources.MsgBox_ErrorMainModelLoadWeb)));
}
else
{
MessageBoxes.ShowMainModelErrorMessageBox(AppResources.MsgBox_ErrorMainModelLoadWeb);
}
this.feed.ForceReadFile();
}
@@ -181,8 +209,16 @@ namespace CampusAppWP8.Pages.Exams
/// <remarks>Stubbfel, 02.09.2013.</remarks>
private void FeedIsFailFile()
{
MessageBoxResult result = MessageBoxes.ShowMainModelErrorMessageBox(AppResources.MsgBox_ErrorMainModelLoadFile);
this.DefHeader.ProgressVisibility = Visibility.Collapsed;
if (this.Dispatcher != null)
{
this.Dispatcher.BeginInvoke(new Action(() => MessageBoxes.ShowMainModelErrorMessageBox(AppResources.MsgBox_ErrorMainModelLoadFile)));
this.Dispatcher.BeginInvoke(new Action(() => this.DefHeader.ProgressVisibility = Visibility.Collapsed));
}
else
{
MessageBoxes.ShowMainModelErrorMessageBox(AppResources.MsgBox_ErrorMainModelLoadFile);
this.DefHeader.ProgressVisibility = Visibility.Collapsed;
}
}
/// <summary>Event handler. Called by Button for click events.</summary>