From 47e4b18ce59cbdbf89022fc265f8148af061f546 Mon Sep 17 00:00:00 2001 From: Christian Fiedler Date: Wed, 21 Aug 2013 15:42:51 +0200 Subject: [PATCH] #160 #161 --- .../Departments/DepartmentFavoriteFeed.cs | 6 +- .../Feed/Departments/DepartmentFeed.cs | 6 +- .../CampusAppWP8/Feed/Events/EventFeed.cs | 6 +- .../CampusAppWP8/Feed/Link/ClubLinkFeed.cs | 6 +- .../CampusAppWP8/Feed/Link/CommonLinkFeed.cs | 6 +- .../CampusAppWP8/Feed/Mensa/MensaFeed.cs | 6 +- .../CampusAppWP8/Feed/News/NewsFeed.cs | 6 +- .../Feed/Openinghours/OpeninghoursFeed.cs | 6 +- .../Feed/StudentCouncil/StudentCouncilFeed.cs | 6 +- CampusAppWP8/CampusAppWP8/LocalizedStrings.cs | 27 +- CampusAppWP8/CampusAppWP8/Model/MainModel.cs | 310 +++++++++--------- .../Departments/DepartmentFavoritePage.xaml | 1 + .../DepartmentFavoritePage.xaml.cs | 3 + .../Departments/DepartmentIndexPage.xaml | 1 + .../Departments/DepartmentIndexPage.xaml.cs | 16 +- .../Pages/Departments/DepartmentPage.xaml | 2 + .../Pages/Departments/DepartmentPage.xaml.cs | 3 + .../Pages/Events/EventIndexPage.xaml | 1 + .../Pages/Events/EventIndexPage.xaml.cs | 16 +- .../CampusAppWP8/Pages/Events/EventPage.xaml | 2 + .../Pages/Events/EventPage.xaml.cs | 3 + .../Pages/Lecture/LecturePage.xaml.cs | 4 +- .../CampusAppWP8/Pages/Links/LinkPage.xaml.cs | 12 +- .../Pages/Mensa/MensaPage.xaml.cs | 10 +- .../Pages/News/NewsIndexPage.xaml | 1 + .../Pages/News/NewsIndexPage.xaml.cs | 10 +- .../CampusAppWP8/Pages/News/NewsPage.xaml | 2 + .../CampusAppWP8/Pages/News/NewsPage.xaml.cs | 5 +- .../Pages/Openinghours/OpeninghoursPage.xaml | 2 +- .../Openinghours/OpeninghoursPage.xaml.cs | 16 +- .../StudentCouncil/StudentCouncilPage.xaml.cs | 6 +- .../CampusAppWP8/Resources/AppResources.resx | 1 + CampusAppWP8/CampusAppWP8/Utility/File.cs | 26 +- 33 files changed, 301 insertions(+), 233 deletions(-) diff --git a/CampusAppWP8/CampusAppWP8/Feed/Departments/DepartmentFavoriteFeed.cs b/CampusAppWP8/CampusAppWP8/Feed/Departments/DepartmentFavoriteFeed.cs index 3d844c1a..20a1a29c 100644 --- a/CampusAppWP8/CampusAppWP8/Feed/Departments/DepartmentFavoriteFeed.cs +++ b/CampusAppWP8/CampusAppWP8/Feed/Departments/DepartmentFavoriteFeed.cs @@ -4,7 +4,7 @@ // // fiedlchr // 01.07.2013 -//----------------------------------------------------------------------using System; +//---------------------------------------------------------------------- namespace CampusAppWP8.Feed.Departments { using System.IO; @@ -26,8 +26,8 @@ namespace CampusAppWP8.Feed.Departments public DepartmentFavoriteFeed(bool autoLoad = true) : base(ModelType.File, Constants.FileDepartment_Favorite_Name, string.Empty) { - this.isFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDateOnLoad); - this.isFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDateOnSave); + this.IsFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDateOnLoad); + this.IsFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDateOnSave); if (autoLoad == true) { diff --git a/CampusAppWP8/CampusAppWP8/Feed/Departments/DepartmentFeed.cs b/CampusAppWP8/CampusAppWP8/Feed/Departments/DepartmentFeed.cs index 93e71301..3f964c67 100644 --- a/CampusAppWP8/CampusAppWP8/Feed/Departments/DepartmentFeed.cs +++ b/CampusAppWP8/CampusAppWP8/Feed/Departments/DepartmentFeed.cs @@ -27,9 +27,9 @@ namespace CampusAppWP8.Feed.Departments public DepartmentFeed(bool autoLoad = true) : base(ModelType.FileAndFeed, Constants.FileDepartment_Name, Constants.UrlDepartment_Addr) { - this.isFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDateOnLoad); - this.isFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDateOnSave); - this.isModelUpToDateOnLoad += 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) { diff --git a/CampusAppWP8/CampusAppWP8/Feed/Events/EventFeed.cs b/CampusAppWP8/CampusAppWP8/Feed/Events/EventFeed.cs index 3151e488..60216204 100644 --- a/CampusAppWP8/CampusAppWP8/Feed/Events/EventFeed.cs +++ b/CampusAppWP8/CampusAppWP8/Feed/Events/EventFeed.cs @@ -25,9 +25,9 @@ namespace CampusAppWP8.Feed.Events public EventFeed(bool autoLoad = true) : base(ModelType.FileAndFeed, Constants.FileEvents_Name, Constants.UrlEvents_Addr) { - this.isFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDateOnLoad); - this.isFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDateOnSave); - this.isModelUpToDateOnLoad += 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) { diff --git a/CampusAppWP8/CampusAppWP8/Feed/Link/ClubLinkFeed.cs b/CampusAppWP8/CampusAppWP8/Feed/Link/ClubLinkFeed.cs index edcba0f7..e2608efa 100644 --- a/CampusAppWP8/CampusAppWP8/Feed/Link/ClubLinkFeed.cs +++ b/CampusAppWP8/CampusAppWP8/Feed/Link/ClubLinkFeed.cs @@ -27,9 +27,9 @@ namespace CampusAppWP8.Feed.Link public ClubLinkFeed() : base(ModelType.FileAndFeed, Constants.FileLink_ClubLinks, Constants.UrlLink_ClubLinks) { - this.isFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDate); - this.isModelUpToDateOnLoad += new IsModelUpToDate(this.CheckIsModelUpToDate); - this.isFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDate); + this.IsFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDate); + this.IsModelUpToDateOnLoad += new IsModelUpToDate(this.CheckIsModelUpToDate); + this.IsFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDate); } #endregion diff --git a/CampusAppWP8/CampusAppWP8/Feed/Link/CommonLinkFeed.cs b/CampusAppWP8/CampusAppWP8/Feed/Link/CommonLinkFeed.cs index f63e2b37..0f988eeb 100644 --- a/CampusAppWP8/CampusAppWP8/Feed/Link/CommonLinkFeed.cs +++ b/CampusAppWP8/CampusAppWP8/Feed/Link/CommonLinkFeed.cs @@ -27,9 +27,9 @@ namespace CampusAppWP8.Feed.Link public CommonLinkFeed() : base(ModelType.FileAndFeed, Constants.FileLink_CommonLinks, Constants.UrlLink_CommonLinks) { - this.isFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDate); - this.isFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDate); - this.isModelUpToDateOnLoad += new IsModelUpToDate(this.CheckIsModelUpToDate); + this.IsFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDate); + this.IsFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDate); + this.IsModelUpToDateOnLoad += new IsModelUpToDate(this.CheckIsModelUpToDate); } #endregion diff --git a/CampusAppWP8/CampusAppWP8/Feed/Mensa/MensaFeed.cs b/CampusAppWP8/CampusAppWP8/Feed/Mensa/MensaFeed.cs index 950fc50e..b162e5d6 100644 --- a/CampusAppWP8/CampusAppWP8/Feed/Mensa/MensaFeed.cs +++ b/CampusAppWP8/CampusAppWP8/Feed/Mensa/MensaFeed.cs @@ -27,9 +27,9 @@ namespace CampusAppWP8.Feed.Mensa protected MensaFeed(string fileName, string feedUrl) : base(ModelType.FileAndFeed, fileName, feedUrl) { - this.isFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDate); - this.isModelUpToDateOnLoad += new IsModelUpToDate(this.CheckIsModelUpToDate); - this.isFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDate); + this.IsFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDate); + this.IsModelUpToDateOnLoad += new IsModelUpToDate(this.CheckIsModelUpToDate); + this.IsFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDate); } #endregion diff --git a/CampusAppWP8/CampusAppWP8/Feed/News/NewsFeed.cs b/CampusAppWP8/CampusAppWP8/Feed/News/NewsFeed.cs index b194b720..2fec1634 100644 --- a/CampusAppWP8/CampusAppWP8/Feed/News/NewsFeed.cs +++ b/CampusAppWP8/CampusAppWP8/Feed/News/NewsFeed.cs @@ -25,9 +25,9 @@ namespace CampusAppWP8.Feed.News public NewsFeed(bool autoLoad = true) : base(ModelType.FileAndFeed, Constants.FileNews_Name, Constants.UrlNews_Addr) { - this.isFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDateOnLoad); - this.isFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDateOnSave); - this.isModelUpToDateOnLoad += 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) { diff --git a/CampusAppWP8/CampusAppWP8/Feed/Openinghours/OpeninghoursFeed.cs b/CampusAppWP8/CampusAppWP8/Feed/Openinghours/OpeninghoursFeed.cs index 3a6f083c..cf60760a 100644 --- a/CampusAppWP8/CampusAppWP8/Feed/Openinghours/OpeninghoursFeed.cs +++ b/CampusAppWP8/CampusAppWP8/Feed/Openinghours/OpeninghoursFeed.cs @@ -26,9 +26,9 @@ namespace CampusAppWP8.Feed.Openinghours public OpeninghoursFeed() : base(ModelType.FileAndFeed, Constants.FileOpeningHours_OpeningHours, Constants.UrlOpeningHours_OpeningHours) { - this.isFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDateOnLoad); - this.isFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDateOnSave); - this.isModelUpToDateOnLoad += new IsModelUpToDate(this.CheckIsModelUpToDate); + this.IsFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDateOnLoad); + this.IsFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDateOnSave); + this.IsModelUpToDateOnLoad += new IsModelUpToDate(this.CheckIsModelUpToDate); } #endregion diff --git a/CampusAppWP8/CampusAppWP8/Feed/StudentCouncil/StudentCouncilFeed.cs b/CampusAppWP8/CampusAppWP8/Feed/StudentCouncil/StudentCouncilFeed.cs index 64098618..9db17651 100644 --- a/CampusAppWP8/CampusAppWP8/Feed/StudentCouncil/StudentCouncilFeed.cs +++ b/CampusAppWP8/CampusAppWP8/Feed/StudentCouncil/StudentCouncilFeed.cs @@ -27,9 +27,9 @@ namespace CampusAppWP8.Feed.StudentCouncil public StudentCouncilFeed() : base(ModelType.FileAndFeed, Constants.FileStudentCouncil_StudentCouncils, Constants.UrlStudentCouncil_StudentCouncils) { - this.isFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDate); - this.isModelUpToDateOnLoad += new IsModelUpToDate(this.CheckIsModelUpToDate); - this.isFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDate); + this.IsFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDate); + this.IsModelUpToDateOnLoad += new IsModelUpToDate(this.CheckIsModelUpToDate); + this.IsFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDate); } #endregion diff --git a/CampusAppWP8/CampusAppWP8/LocalizedStrings.cs b/CampusAppWP8/CampusAppWP8/LocalizedStrings.cs index e2063778..f0a4a960 100644 --- a/CampusAppWP8/CampusAppWP8/LocalizedStrings.cs +++ b/CampusAppWP8/CampusAppWP8/LocalizedStrings.cs @@ -1,14 +1,27 @@ -using CampusAppWP8.Resources; - +//----------------------------------------------------------------------------- +// +// Company copyright tag. +// +// 16.07.2013 +//----------------------------------------------------------------------------- namespace CampusAppWP8 { - /// - /// Bietet Zugriff auf Zeichenfolgenressourcen. - /// + using CampusAppWP8.Resources; + + /// Localized strings. public class LocalizedStrings { - private static AppResources _localizedResources = new AppResources(); + /// The localized resources. + private static AppResources localizedResources = new AppResources(); - public AppResources LocalizedResources { get { return _localizedResources; } } + /// Gets the localized resources. + /// The localized resources. + public AppResources LocalizedResources + { + get + { + return localizedResources; + } + } } } \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Model/MainModel.cs b/CampusAppWP8/CampusAppWP8/Model/MainModel.cs index 3942d302..8a549d87 100644 --- a/CampusAppWP8/CampusAppWP8/Model/MainModel.cs +++ b/CampusAppWP8/CampusAppWP8/Model/MainModel.cs @@ -97,24 +97,9 @@ namespace CampusAppWP8 } /// - /// Delegate of the OnLoading callback function. + /// Delegate of the OnIO callback function. /// - public delegate void OnLoading(); - - /// - /// Delegate of the OnLoaded callback function. - /// - public delegate void OnLoaded(); - - /// - /// Delegate of the OnSaving callback function. - /// - public delegate void OnSaving(); - - /// - /// Delegate of the OnSaved callback function. - /// - public delegate void OnSaved(); + public delegate void OnIO(); /// /// Delegate of the OnFailed(File/Web) callback function. @@ -139,64 +124,64 @@ namespace CampusAppWP8 /// /// Callback pointer, called before loading. /// - public event OnLoading onLoading = null; + public event OnIO OnLoading = null; /// /// Callback pointer, called after loading. /// - public event OnLoaded onLoaded = null; + public event OnIO OnLoaded = null; /// /// Callback pointer, called before saving. /// - public event OnSaving onSaving = null; + public event OnIO OnSaving = null; /// /// Callback pointer, called after saving. /// - public event OnSaved onSaved = null; + public event OnIO OnSaved = null; /// /// Callback pointer, called after failed file loading. /// - public event OnFailed onFailedFile = null; + public event OnFailed OnFailedFile = null; /// /// Callback pointer, called after failed web loading. /// - public event OnFailed onFailedWeb = null; + public event OnFailed OnFailedWeb = null; /// /// Callback pointer, called after failed file or web loading, if there /// is no specialized onFailed callback set. /// - public event OnFailed onFailed = null; + public event OnFailed OnFailedLoad = null; /// /// Callback pointer, called after failed saving data to file. /// - public event OnFailed onFailedSave = null; + public event OnFailed OnFailedSave = null; /// /// Callback pointer, for checking if file is up to date at loading. /// - public event IsFileUpToDate isFileUpToDateOnLoad = null; + public event IsFileUpToDate IsFileUpToDateOnLoad = null; /// /// Callback pointer, for checking if file is up to date at saving. /// - public event IsFileUpToDate isFileUpToDateOnSave = null; + public event IsFileUpToDate IsFileUpToDateOnSave = null; /// /// Callback pointer, for checking if model is up to date at loading. /// - public event IsModelUpToDate isModelUpToDateOnLoad = null; + public event IsModelUpToDate IsModelUpToDateOnLoad = null; /// /// Callback pointer, for checking if model is up to date at saving. /// (currently unused) /// - public event IsModelUpToDate isModelUpToDateOnSave = null; + public event IsModelUpToDate IsModelUpToDateOnSave = null; /// /// Specifies the I/O type of the model. @@ -224,6 +209,19 @@ namespace CampusAppWP8 FileAndFeed = 3 } + /// Values that represent ForceType for load function. + public enum ForceType + { + /// An enumeration constant representing the invalid/default/unset option. + INVALID = 0, + + /// An enumeration constant representing the force file option. + FORCE_FILE = 1, + + /// An enumeration constant representing the force web option. + FORCE_WEB = 2 + } + /// /// Gets or sets the Model. /// @@ -253,15 +251,7 @@ namespace CampusAppWP8 /// public void ForceWebUpdate() { - if (this.api != null) - { - if (this.onLoading != null) - { - this.onLoading(); - } - - this.api.HttpGet(this.httpApiUri, this.OnLoadDataComplete); - } + this.LoadData(ForceType.FORCE_WEB); } /// @@ -269,80 +259,60 @@ namespace CampusAppWP8 /// public void ForceReadFile() { - if (this.file != null) - { - if (this.onLoading != null) - { - this.onLoading(); - } - - string data = this.file.ReadFile(); - - if (data == null) - { - if (this.onFailedFile != null) - { - this.onFailedFile(); - } - else if (this.onFailed != null) - { - this.onFailed(); - } - } - else if (!data.Equals(string.Empty)) - { - this.DeserializeModel(Encoding.UTF8.GetBytes(data)); - } - - if ((data != null) && (this.onLoaded != null)) - { - this.onLoaded(); - } - } + this.LoadData(ForceType.FORCE_FILE); } /// /// Load the data if necessary, from web or from file, regarding if /// the file data is up to date. /// - public void LoadData() + /// if set/not invalid/not default, force to load from web or file + public void LoadData(ForceType force = ForceType.INVALID) { - bool loadFromFile = true; - - if (this.onLoading != null) + this.RunOnIOCallback(this.OnLoading); + + // check which source is used for loading the data + if (force == ForceType.INVALID) { - this.onLoading(); - } - - if (((this.isModelUpToDateOnLoad == null) - || (this.isModelUpToDateOnLoad(this.model) == false)) - && ((this.file != null) || this.api != null)) - { - if (this.file != null) + // if the model is not up to date + if (this.CheckIsNotUpToDate(this.IsModelUpToDateOnLoad) == true) { - if ((this.file.Exist() == false) - || (this.file.GetFileInfo().Length == 0)) + force = ForceType.FORCE_FILE; + + if (this.file != null) { - loadFromFile = false; + // if the file does not exist or is size of 0 or is not + // up to date, then load from web + if ((this.file.Exist() == false) + || (this.file.GetFileInfo().Length == 0) + || (this.CheckIsNotUpToDate(this.IsFileUpToDateOnLoad) == true)) + { + force = ForceType.FORCE_WEB; + } + } + else + { + // if the file object does not exist, load from web + force = ForceType.FORCE_WEB; } - if (((this.isFileUpToDateOnLoad != null) && (this.isFileUpToDateOnLoad(this.model, this.file.GetFileInfo()) == false)) - || (this.isFileUpToDateOnLoad == null)) + // if the web object does not exist, load from file + if (this.api == null) { - loadFromFile = false; + force = ForceType.FORCE_FILE; } } else { - loadFromFile = false; + // if it is up to date, nothing has to be loaded + this.RunOnIOCallback(this.OnLoaded); } + } - if (this.api == null) - { - loadFromFile = true; - } - - if (loadFromFile == false) + // load from web + if (force == ForceType.FORCE_WEB) + { + if (this.api != null) { if (this.paramizedUri != null) { @@ -354,32 +324,37 @@ namespace CampusAppWP8 } } else + { + // if web object does not exist, call OnFailed callbacks + this.RunOnFailedCallback(this.OnFailedWeb, this.OnFailedLoad); + } + } + + // load from file + if (force == ForceType.FORCE_FILE) + { + if (this.file != null) { string data = this.file.ReadFile(); if (data == null) { - if (this.onFailedFile != null) - { - this.onFailedFile(); - } - else if (this.onFailed != null) - { - this.onFailed(); - } + this.RunOnFailedCallback(this.OnFailedFile, this.OnFailedLoad); } - else if (!data.Equals(string.Empty)) + else { - this.DeserializeModel(Encoding.UTF8.GetBytes(data)); + if (!data.Equals(string.Empty)) + { + this.DeserializeModel(Encoding.UTF8.GetBytes(data)); + } + + this.RunOnIOCallback(this.OnLoaded); } } - } - - if (loadFromFile == true) - { - if (this.onLoaded != null) + else { - this.onLoaded(); + // if file object does not exist, call OnFailed callbacks + this.RunOnFailedCallback(this.OnFailedFile, this.OnFailedLoad); } } } @@ -391,40 +366,28 @@ namespace CampusAppWP8 public void SaveData(bool force = false) { if ((this.file != null) - && ((this.isFileUpToDateOnSave == null) - || (this.isFileUpToDateOnSave(this.model, this.file.GetFileInfo()) == false) - || (force == true))) + && ((this.CheckIsNotUpToDate(this.IsFileUpToDateOnSave) == true) || (force == true))) { - if (this.onSaving != null) - { - this.onSaving(); - } - + this.RunOnIOCallback(this.OnSaving); + byte[] data = this.SerializeModel(); - if ((this.onSaved != null) && (this.onFailedSave != null)) + if ((this.OnSaved != null) && (this.OnFailedSave != null)) { - this.file.WriteFile(data, delegate() { this.onSaved(); }, delegate() { this.onFailedSave(); }); + this.file.WriteFile(data, delegate { this.OnSaved(); }, delegate { this.OnFailedSave(); }); } - else if (this.onSaved != null) + else if (this.OnSaved != null) { - this.file.WriteFile(data, delegate() { this.onSaved(); }, null); + this.file.WriteFile(data, delegate { this.OnSaved(); }, null); } - else if (this.onFailedSave != null) + else if (this.OnFailedSave != null) { - this.file.WriteFile(data, null, delegate() { this.onFailedSave(); }); + this.file.WriteFile(data, null, delegate { this.OnFailedSave(); }); } else { this.file.WriteFile(data, null, null); } - - /* - if (this.onSaved != null) - { - this.onSaved(); - } - */ } } @@ -529,7 +492,7 @@ namespace CampusAppWP8 this.fileName = fileName; if ((this.IsFile() == true) - && (fileName.Equals(string.Empty) == false)) + && (fileName.Equals(string.Empty) == false)) { this.InitFile(CampusAppWP8.Utility.File.IOTypeRead.ReadSync, CampusAppWP8.Utility.File.IOTypeWrite.WriteAsync); } @@ -546,7 +509,9 @@ namespace CampusAppWP8 /// /// read io type (Default: sync) /// write io type (Default: async) - private void InitFile(CampusAppWP8.Utility.File.IOTypeRead readType = CampusAppWP8.Utility.File.IOTypeRead.ReadSync, CampusAppWP8.Utility.File.IOTypeWrite writeType = CampusAppWP8.Utility.File.IOTypeWrite.WriteAsync) + private void InitFile( + CampusAppWP8.Utility.File.IOTypeRead readType = CampusAppWP8.Utility.File.IOTypeRead.ReadSync, + CampusAppWP8.Utility.File.IOTypeWrite writeType = CampusAppWP8.Utility.File.IOTypeWrite.WriteAsync) { if ((this.IsFile() == true) && (this.file == null)) @@ -577,28 +542,75 @@ namespace CampusAppWP8 Exception downloadError = e.Error; if (downloadError != null) { - if (this.onFailedWeb != null) + this.RunOnFailedCallback(this.OnFailedWeb, this.OnFailedLoad); + } + else + { + string downloadResult = e.Result; + + if (downloadResult != null && !downloadResult.Equals(string.Empty)) { - this.onFailedWeb(); - } - else if (this.onFailed != null) - { - this.onFailed(); + this.DeserializeModel(Encoding.UTF8.GetBytes(downloadResult)); } - return; + this.RunOnIOCallback(this.OnLoaded); + } + } + + /// + /// Executes the on i/o callback operation. + /// + /// The callback function. + private void RunOnIOCallback(OnIO callbackFunc) + { + if (callbackFunc != null) + { + callbackFunc(); + } + } + + /// Executes the on failed callback operation. + /// The special function. + /// The default function. + private void RunOnFailedCallback(OnFailed specialFunc, OnFailed defaultFunc) + { + if (specialFunc != null) + { + specialFunc(); + } + else if (defaultFunc != null) + { + defaultFunc(); + } + } + + /// Check if model or file is not up to date. + /// The check function. + /// true if model or file is not up to date, false if it is. + private bool CheckIsNotUpToDate(object checkFunc) + { + bool retValue = false; + + // if there is no check function, the model or file is not up to date + if (checkFunc == null) + { + retValue = true; + } + else + { + Type funcType = checkFunc.GetType(); + + if (funcType.Equals(typeof(IsFileUpToDate))) + { + retValue = !(checkFunc as IsFileUpToDate)(this.model, this.file.GetFileInfo()); + } + else if (funcType.Equals(typeof(IsModelUpToDate))) + { + retValue = !(checkFunc as IsModelUpToDate)(this.model); + } } - string downloadResult = e.Result; - if (downloadResult != null && !downloadResult.Equals(string.Empty)) - { - this.DeserializeModel(Encoding.UTF8.GetBytes(downloadResult)); - } - - if (this.onLoaded != null) - { - this.onLoaded(); - } + return retValue; } } } \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentFavoritePage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentFavoritePage.xaml index fb8dd7df..41b7eb21 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentFavoritePage.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentFavoritePage.xaml @@ -20,6 +20,7 @@ + diff --git a/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentFavoritePage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentFavoritePage.xaml.cs index 533a6f04..3877c73d 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentFavoritePage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentFavoritePage.xaml.cs @@ -53,6 +53,7 @@ namespace CampusAppWP8.Pages.Departments protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); + this.progressBar.Visibility = Visibility.Visible; if (this.isNewInstance) { @@ -80,6 +81,8 @@ namespace CampusAppWP8.Pages.Departments this.ContentPanel.ItemsSource = DepartmentIndexPage.GetFavoriteFeed().GetModel().Faculties[0].Chairs; this.isSourceSet = true; } + + this.progressBar.Visibility = Visibility.Collapsed; } /// diff --git a/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentIndexPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentIndexPage.xaml index 6ac7f84f..b1f6f8b6 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentIndexPage.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentIndexPage.xaml @@ -22,6 +22,7 @@ + diff --git a/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentIndexPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentIndexPage.xaml.cs index 7d8ee8da..3e54758a 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentIndexPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentIndexPage.xaml.cs @@ -37,6 +37,7 @@ namespace CampusAppWP8.Pages.Departments public DepartmentIndexPage() { this.InitializeComponent(); + this.progressBar.Visibility = Visibility.Visible; //// init feed objects if (DepartmentIndexPage.feed == null) @@ -44,9 +45,9 @@ namespace CampusAppWP8.Pages.Departments DepartmentIndexPage.feed = new DepartmentFeed(false); } - 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.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(); if (DepartmentIndexPage.favorite == null) @@ -54,8 +55,7 @@ namespace CampusAppWP8.Pages.Departments DepartmentIndexPage.favorite = new DepartmentFavoriteFeed(false); } - DepartmentIndexPage.favorite.onLoaded += new DepartmentFavoriteFeed.OnLoaded(this.CheckFavoriteFeed); - DepartmentIndexPage.favorite.onFailedFile += new DepartmentFavoriteFeed.OnFailed(this.FeedIsFailFile); + DepartmentIndexPage.favorite.OnFailedFile += new DepartmentFavoriteFeed.OnFailed(this.CheckFavoriteFeed); DepartmentIndexPage.favorite.LoadData(); } @@ -159,6 +159,7 @@ namespace CampusAppWP8.Pages.Departments private void SetupFacultyList() { this.FacultyList.ItemsSource = DepartmentIndexPage.feed.GetModel().Faculties; + this.progressBar.Visibility = Visibility.Collapsed; } /// @@ -213,7 +214,7 @@ namespace CampusAppWP8.Pages.Departments /// /// Method will be execute if the feed is failed /// - private void FeedIsFailWeb() + private void FeedIsFailedWeb() { MessageBoxResult result = MessageBoxes.ShowMainModelErrorMessageBox(AppResources.MsgBox_ErrorMainModelLoadWeb); DepartmentIndexPage.feed.ForceReadFile(); @@ -222,8 +223,9 @@ namespace CampusAppWP8.Pages.Departments /// /// Method will be execute if the feed is failed /// - private void FeedIsFailFile() + private void FeedIsFailedFile() { + this.progressBar.Visibility = Visibility.Collapsed; MessageBoxResult result = MessageBoxes.ShowMainModelErrorMessageBox(AppResources.MsgBox_ErrorMainModelLoadFile); } } diff --git a/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentPage.xaml index d39e152b..62fd0e93 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentPage.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentPage.xaml @@ -20,6 +20,8 @@ + + diff --git a/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentPage.xaml.cs index d0517b3a..e5dd9428 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentPage.xaml.cs @@ -54,6 +54,7 @@ namespace CampusAppWP8.Pages.Departments protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); + this.progressBar.Visibility = Visibility.Visible; if (this.isNewInstance) { @@ -99,6 +100,8 @@ namespace CampusAppWP8.Pages.Departments MessageBox.Show("ERROR: pivotIndex out of range!!!"); } } + + this.progressBar.Visibility = Visibility.Collapsed; } /// diff --git a/CampusAppWP8/CampusAppWP8/Pages/Events/EventIndexPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Events/EventIndexPage.xaml index 3f4eefd8..0aac8c25 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Events/EventIndexPage.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/Events/EventIndexPage.xaml @@ -21,6 +21,7 @@ + diff --git a/CampusAppWP8/CampusAppWP8/Pages/Events/EventIndexPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Events/EventIndexPage.xaml.cs index d8e1bc11..bb9f2dc7 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Events/EventIndexPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Events/EventIndexPage.xaml.cs @@ -32,6 +32,7 @@ namespace CampusAppWP8.Pages.Events public EventIndexPage() { this.InitializeComponent(); + this.progressBar.Visibility = Visibility.Visible; ApplicationBarIconButton updateBtn = new ApplicationBarIconButton(); updateBtn.IconUri = new Uri(Icons.Update, UriKind.Relative); @@ -44,9 +45,9 @@ namespace CampusAppWP8.Pages.Events EventIndexPage.eventFeed = new EventFeed(false); } - 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.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(); } @@ -95,6 +96,7 @@ namespace CampusAppWP8.Pages.Events private void SetupEventPageList() { this.EventList.ItemsSource = EventIndexPage.eventFeed.Model.Channel[0].Item; + this.progressBar.Visibility = Visibility.Collapsed; } /// @@ -105,24 +107,26 @@ namespace CampusAppWP8.Pages.Events /// event args private void EventForceUpdate_Click(object sender, EventArgs e) { + this.progressBar.Visibility = Visibility.Visible; EventIndexPage.eventFeed.ForceWebUpdate(); } /// /// Method will be execute if the feed is failed /// - private void FeedIsFailWeb() + private void FeedIsFailedWeb() { MessageBoxResult result = MessageBoxes.ShowMainModelErrorMessageBox(AppResources.MsgBox_ErrorMainModelLoadWeb); - EventIndexPage.eventFeed.ForceReadFile(); + EventIndexPage.eventFeed.ForceReadFile(); } /// /// Method will be execute if the feed is failed /// - private void FeedIsFailFile() + private void FeedIsFailedFile() { MessageBoxResult result = MessageBoxes.ShowMainModelErrorMessageBox(AppResources.MsgBox_ErrorMainModelLoadFile); + this.progressBar.Visibility = Visibility.Collapsed; } } } \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml index 956943b7..3597dbbd 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml @@ -19,6 +19,8 @@ + + diff --git a/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml.cs index 78a5493e..893982e6 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml.cs @@ -64,6 +64,7 @@ namespace CampusAppWP8.Pages.Events protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); + this.progressBar.Visibility = Visibility.Visible; if (this.isNewInstance) { @@ -117,6 +118,8 @@ namespace CampusAppWP8.Pages.Events MessageBox.Show("ERROR: pivotIndex out of range!!! (" + o + ")"); } } + + this.progressBar.Visibility = Visibility.Collapsed; } /// diff --git a/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs index 27dd9d1b..a29a037d 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs @@ -166,8 +166,8 @@ namespace CampusAppWP8.Pages.Lecture private void SendRequest(object sender, RoutedEventArgs e) { this.api = new LectureApi(); - this.api.onLoaded += new LectureApi.OnLoaded(this.ApiIsReady); - this.api.onFailed += new LectureApi.OnFailed(this.ApiIsFail); + this.api.OnLoaded += new LectureApi.OnIO(this.ApiIsReady); + this.api.OnFailedLoad += new LectureApi.OnFailed(this.ApiIsFail); this.ProgressBar.Visibility = System.Windows.Visibility.Visible; List parameterList = this.CreateUrlParameter(); this.api.SetUriParams(parameterList); diff --git a/CampusAppWP8/CampusAppWP8/Pages/Links/LinkPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Links/LinkPage.xaml.cs index d445116b..30ff8fa0 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Links/LinkPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Links/LinkPage.xaml.cs @@ -105,9 +105,9 @@ namespace CampusAppWP8.Pages.Links private void InitializeCommonLinkFeed() { 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); + this.commonLinkFeed.OnLoaded += new CommonLinkFeed.OnIO(this.CommonLinkFeedIsReady); + this.commonLinkFeed.OnFailedWeb += new CommonLinkFeed.OnFailed(this.CommonLinkFeedIsFailWeb); + this.commonLinkFeed.OnFailedFile += new CommonLinkFeed.OnFailed(this.FeedIsFailFile); } /// @@ -116,9 +116,9 @@ namespace CampusAppWP8.Pages.Links private void InitializeClubLinkFeed() { 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); + this.clubLinkFeed.OnLoaded += new ClubLinkFeed.OnIO(this.ClubLinkFeedIsReady); + this.clubLinkFeed.OnFailedWeb += new ClubLinkFeed.OnFailed(this.ClubLinkFeedIsFailWeb); + this.clubLinkFeed.OnFailedFile += new ClubLinkFeed.OnFailed(this.FeedIsFailFile); } /// diff --git a/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml.cs index b1931f73..4f85b351 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml.cs @@ -125,8 +125,8 @@ namespace CampusAppWP8.Pages.Mensa private void DeterminCurrentCampusAndLoadFeed() { this.campusApi = new CampusSpsApi(); - this.campusApi.onLoaded += new SpsApi.OnLoaded(this.SpsApiIsReady); - this.campusApi.onFailed += new SpsApi.OnFailed(this.SpsApiIsFail); + this.campusApi.OnLoaded += new SpsApi.OnIO(this.SpsApiIsReady); + this.campusApi.OnFailedLoad += new SpsApi.OnFailed(this.SpsApiIsFail); this.campusApi.SetupCurrentCampusRequest(); this.campusApi.LoadData(); } @@ -138,9 +138,9 @@ namespace CampusAppWP8.Pages.Mensa private void InitializeFeed(CampusAppWP8.Model.Setting.UserProfilModel.Campus campus) { 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.feed.OnLoaded += new MensaFeed.OnIO(this.FeedIsReady); + this.feed.OnFailedWeb += new MensaFeed.OnFailed(this.FeedIsFailWeb); + this.feed.OnFailedFile += new MensaFeed.OnFailed(this.FeedIsFailFile); this.CalcSelectedIndex(); if (this.forceLoad) diff --git a/CampusAppWP8/CampusAppWP8/Pages/News/NewsIndexPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/News/NewsIndexPage.xaml index 1deea115..1376bfb3 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/News/NewsIndexPage.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/News/NewsIndexPage.xaml @@ -21,6 +21,7 @@ + diff --git a/CampusAppWP8/CampusAppWP8/Pages/News/NewsIndexPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/News/NewsIndexPage.xaml.cs index b5cb6933..7a8b5e57 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/News/NewsIndexPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/News/NewsIndexPage.xaml.cs @@ -32,6 +32,7 @@ namespace CampusAppWP8.Pages.News public NewsIndexPage() { this.InitializeComponent(); + this.progressBar.Visibility = Visibility.Collapsed; ApplicationBarIconButton updateBtn = new ApplicationBarIconButton(); updateBtn.IconUri = new Uri(Icons.Update, UriKind.Relative); @@ -44,9 +45,9 @@ namespace CampusAppWP8.Pages.News NewsIndexPage.newsFeed = new NewsFeed(false); } - 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.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(); } @@ -95,6 +96,7 @@ namespace CampusAppWP8.Pages.News private void SetupNewsPageList() { this.NewsList.ItemsSource = NewsIndexPage.newsFeed.Model.Channel[0].Item; + this.progressBar.Visibility = Visibility.Collapsed; } /// @@ -105,6 +107,7 @@ namespace CampusAppWP8.Pages.News /// event args private void NewsForceUpdate_Click(object sender, EventArgs e) { + this.progressBar.Visibility = Visibility.Visible; NewsIndexPage.newsFeed.ForceWebUpdate(); } @@ -122,6 +125,7 @@ namespace CampusAppWP8.Pages.News /// private void FeedIsFailFile() { + this.progressBar.Visibility = Visibility.Collapsed; MessageBoxResult result = MessageBoxes.ShowMainModelErrorMessageBox(AppResources.MsgBox_ErrorMainModelLoadFile); } } diff --git a/CampusAppWP8/CampusAppWP8/Pages/News/NewsPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/News/NewsPage.xaml index 972abeb0..36992213 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/News/NewsPage.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/News/NewsPage.xaml @@ -19,7 +19,9 @@ + + diff --git a/CampusAppWP8/CampusAppWP8/Pages/News/NewsPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/News/NewsPage.xaml.cs index 709a6b7b..3c26f7cb 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/News/NewsPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/News/NewsPage.xaml.cs @@ -45,7 +45,7 @@ namespace CampusAppWP8.Pages.News public NewsPage() { this.InitializeComponent(); - + ApplicationBarIconButton linkBtn = new ApplicationBarIconButton(); linkBtn.IconUri = new Uri(Icons.Link, UriKind.Relative); linkBtn.Text = AppResources.NewsLinkBtn; @@ -64,6 +64,7 @@ namespace CampusAppWP8.Pages.News protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); + this.progressBar.Visibility = Visibility.Visible; if (this.isNewInstance) { @@ -110,6 +111,8 @@ namespace CampusAppWP8.Pages.News MessageBox.Show("ERROR: pivotIndex out of range!!!"); } } + + this.progressBar.Visibility = Visibility.Collapsed; } /// diff --git a/CampusAppWP8/CampusAppWP8/Pages/Openinghours/OpeninghoursPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Openinghours/OpeninghoursPage.xaml index 32570e7c..744eeb92 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Openinghours/OpeninghoursPage.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/Openinghours/OpeninghoursPage.xaml @@ -21,13 +21,13 @@ + -