Merge branch 'hotfix/#129' into develop

Conflicts:
	CampusAppWP8/CampusAppWP8/Pages/Openinghours/OpeninghoursPage.xaml.cs
This commit is contained in:
Christian Fiedler
2013-07-23 16:03:06 +02:00
11 changed files with 348 additions and 22 deletions

View File

@@ -59,7 +59,7 @@ namespace CampusAppWP8.Model.Openinghours
}
/// <summary>
/// Gets the Institutions.
/// Gets or sets the Institutions.
/// </summary>
[XmlArray("data")]
[XmlArrayItem("institution")]

View File

@@ -11,6 +11,7 @@ namespace CampusAppWP8.Pages.Departments
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using CampusAppWP8.Model.Departments;
using CampusAppWP8.Resources;
using Microsoft.Phone.Controls;
@@ -24,12 +25,24 @@ namespace CampusAppWP8.Pages.Departments
/// </summary>
private FrameworkElement lastClickedBtn = null;
/// <summary>
/// For checking if instance is back from tombstone.
/// </summary>
private bool isNewInstance = false;
/// <summary>
/// For checking if the source of the list is set.
/// </summary>
private bool isSourceSet = false;
/// <summary>
/// Initializes a new instance of the <see cref="DepartmentFavoritePage" /> class.
/// </summary>
public DepartmentFavoritePage()
{
this.InitializeComponent();
this.isNewInstance = true;
}
/// <summary>
@@ -39,7 +52,48 @@ namespace CampusAppWP8.Pages.Departments
/// <param name="e">event args</param>
protected override void OnNavigatedTo(NavigationEventArgs e)
{
this.ContentPanel.ItemsSource = DepartmentIndexPage.GetFavoriteFeed().GetModel().Faculties[0].Chairs;
base.OnNavigatedTo(e);
if (this.isNewInstance)
{
if ((DepartmentIndexPage.FavoriteFeed == null) || (DepartmentIndexPage.FavoriteFeed.GetModel() == null))
{
DepartmentModel tempModel = null;
if ((tempModel = App.LoadFromIsolatedStorage<DepartmentModel>(Constants.IsolatedStorage_DepartmentFavoriteModel)) != null)
{
if (DepartmentIndexPage.FavoriteFeed == null)
{
DepartmentIndexPage.FavoriteFeed = new Feed.Departments.DepartmentFavoriteFeed(false);
}
DepartmentIndexPage.FavoriteFeed.Model = tempModel;
this.isSourceSet = false;
}
}
this.isNewInstance = false;
}
if (this.isSourceSet == false)
{
this.ContentPanel.ItemsSource = DepartmentIndexPage.GetFavoriteFeed().GetModel().Faculties[0].Chairs;
this.isSourceSet = true;
}
}
/// <summary>
/// Override the OnNavigatedFrom function.
/// </summary>
/// <param name="e">event args</param>
protected override void OnNavigatedFrom(NavigationEventArgs e)
{
base.OnNavigatedFrom(e);
if (e.NavigationMode != System.Windows.Navigation.NavigationMode.Back)
{
App.SaveToIsolatedStorage<DepartmentModel>(Constants.IsolatedStorage_DepartmentFavoriteModel, DepartmentIndexPage.FavoriteFeed.GetModel());
}
}
/// <summary>

View File

@@ -55,6 +55,44 @@ namespace CampusAppWP8.Pages.Departments
DepartmentIndexPage.favorite.LoadData();
}
/// <summary>
/// Gets or sets the feed object.
/// </summary>
public static DepartmentFeed Feed
{
get
{
return DepartmentIndexPage.feed;
}
set
{
if (value != DepartmentIndexPage.feed)
{
DepartmentIndexPage.feed = value;
}
}
}
/// <summary>
/// Gets or sets the favorite feed object.
/// </summary>
public static DepartmentFavoriteFeed FavoriteFeed
{
get
{
return DepartmentIndexPage.favorite;
}
set
{
if (DepartmentIndexPage.favorite != value)
{
DepartmentIndexPage.favorite = value;
}
}
}
/// <summary>
/// Return the feed object of the departments.
/// </summary>

View File

@@ -12,6 +12,7 @@ namespace CampusAppWP8.Pages.Departments
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using CampusAppWP8.Model.Departments;
using CampusAppWP8.Resources;
using Microsoft.Phone.Controls;
@@ -30,12 +31,19 @@ namespace CampusAppWP8.Pages.Departments
/// </summary>
private FrameworkElement lastClickedBtn = null;
/// <summary>
/// For checking of the instance is back from tombstone.
/// </summary>
private bool isNewInstance = false;
/// <summary>
/// Initializes a new instance of the <see cref="DepartmentPage" /> class.
/// </summary>
public DepartmentPage()
{
this.InitializeComponent();
this.isNewInstance = true;
}
/// <summary>
@@ -47,6 +55,27 @@ namespace CampusAppWP8.Pages.Departments
{
base.OnNavigatedTo(e);
if (this.isNewInstance)
{
if ((DepartmentIndexPage.Feed == null) || (DepartmentIndexPage.Feed.GetModel() == null))
{
DepartmentModel tempModel = null;
if ((tempModel = App.LoadFromIsolatedStorage<DepartmentModel>(Constants.IsolatedStorage_DepartmentModel)) != null)
{
if (DepartmentIndexPage.Feed == null)
{
DepartmentIndexPage.Feed = new Feed.Departments.DepartmentFeed(false);
}
DepartmentIndexPage.Feed.Model = tempModel;
this.isSourceSet = false;
}
}
this.isNewInstance = false;
}
if (this.isSourceSet == false)
{
this.DepartmentPivot.ItemsSource = DepartmentIndexPage.GetFeed().GetModel().Faculties;
@@ -72,6 +101,20 @@ namespace CampusAppWP8.Pages.Departments
}
}
/// <summary>
/// Override the OnNavigatedFrom function.
/// </summary>
/// <param name="e">event args</param>
protected override void OnNavigatedFrom(NavigationEventArgs e)
{
base.OnNavigatedFrom(e);
if (e.NavigationMode != System.Windows.Navigation.NavigationMode.Back)
{
App.SaveToIsolatedStorage<DepartmentModel>(Constants.IsolatedStorage_DepartmentModel, DepartmentIndexPage.Feed.GetModel());
}
}
/// <summary>
/// On orientation changed.
/// </summary>

View File

@@ -8,11 +8,9 @@
namespace CampusAppWP8.Pages.Events
{
using System;
using System.Linq;
using System.Windows.Navigation;
using CampusAppWP8.Feed.Events;
using CampusAppWP8.Resources;
using CampusAppWP8.Utility;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
@@ -48,6 +46,25 @@ namespace CampusAppWP8.Pages.Events
EventIndexPage.eventFeed.LoadData();
}
/// <summary>
/// Gets or sets the feed object.
/// </summary>
public static EventFeed Feed
{
get
{
return EventIndexPage.eventFeed;
}
set
{
if (EventIndexPage.eventFeed != value)
{
EventIndexPage.eventFeed = value;
}
}
}
/// <summary>
/// Return the eventFeed object.
/// </summary>

View File

@@ -13,11 +13,12 @@ namespace CampusAppWP8.Pages.Events
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using CampusAppWP8.Model.RSS;
using CampusAppWP8.Resources;
using CampusAppWP8.Utility;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
/// <summary>
/// EventPage, where every event fees has his own PivotItem.
/// </summary>
@@ -33,6 +34,11 @@ namespace CampusAppWP8.Pages.Events
/// </summary>
private int lastSelectedIndex = -1;
/// <summary>
/// For checking if the instance is back from tombstone.
/// </summary>
private bool isNewInstance = false;
/// <summary>
/// Initializes a new instance of the <see cref="EventPage" /> class.
/// </summary>
@@ -45,6 +51,8 @@ namespace CampusAppWP8.Pages.Events
linkBtn.Text = AppResources.NewsLinkBtn;
linkBtn.Click += new EventHandler(this.EventLink_Click);
ApplicationBar.Buttons.Add(linkBtn);
this.isNewInstance = true;
}
/// <summary>
@@ -57,6 +65,27 @@ namespace CampusAppWP8.Pages.Events
{
base.OnNavigatedTo(e);
if (this.isNewInstance)
{
if ((EventIndexPage.GetEventFeed() == null) || (EventIndexPage.GetEventFeed().GetModel() == null))
{
RSSViewModel tempModel = null;
if ((tempModel = App.LoadFromIsolatedStorage<RSSViewModel>(Constants.IsolatedStorage_EventRSSModel)) != null)
{
if (EventIndexPage.GetEventFeed() == null)
{
EventIndexPage.Feed = new Feed.Events.EventFeed(false);
}
EventIndexPage.Feed.Model = tempModel;
this.isSourceSet = false;
}
}
this.isNewInstance = false;
}
// Set pivotitem Source
if (this.isSourceSet == false)
{
@@ -90,6 +119,20 @@ namespace CampusAppWP8.Pages.Events
}
}
/// <summary>
/// Override the OnNavigatedFrom function.
/// </summary>
/// <param name="e">event args</param>
protected override void OnNavigatedFrom(NavigationEventArgs e)
{
base.OnNavigatedFrom(e);
if (e.NavigationMode != System.Windows.Navigation.NavigationMode.Back)
{
App.SaveToIsolatedStorage<RSSViewModel>(Constants.IsolatedStorage_EventRSSModel, EventIndexPage.GetEventFeed().GetModel());
}
}
/// <summary>
/// Called when the index of the selected PivotItem is changed.
/// Set the text Grid to visible and the WebBrowser to collapsed.

View File

@@ -46,6 +46,25 @@ namespace CampusAppWP8.Pages.News
NewsIndexPage.newsFeed.LoadData();
}
/// <summary>
/// Gets or sets the feed object.
/// </summary>
public static NewsFeed Feed
{
get
{
return NewsIndexPage.newsFeed;
}
set
{
if (NewsIndexPage.newsFeed != value)
{
NewsIndexPage.newsFeed = value;
}
}
}
/// <summary>
/// Return the newsFeed object.
/// </summary>

View File

@@ -13,6 +13,7 @@ namespace CampusAppWP8.Pages.News
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using CampusAppWP8.Model.RSS;
using CampusAppWP8.Resources;
using CampusAppWP8.Utility;
using Microsoft.Phone.Controls;
@@ -33,6 +34,11 @@ namespace CampusAppWP8.Pages.News
/// </summary>
private int lastSelectedIndex = -1;
/// <summary>
/// For checking if the instance is back from tombstone.
/// </summary>
private bool isNewInstance = false;
/// <summary>
/// Initializes a new instance of the <see cref="NewsPage" /> class.
/// </summary>
@@ -45,6 +51,8 @@ namespace CampusAppWP8.Pages.News
linkBtn.Text = AppResources.NewsLinkBtn;
linkBtn.Click += new EventHandler(this.NewsLink_Click);
ApplicationBar.Buttons.Add(linkBtn);
this.isNewInstance = true;
}
/// <summary>
@@ -56,7 +64,28 @@ namespace CampusAppWP8.Pages.News
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
if (this.isNewInstance)
{
if ((NewsIndexPage.Feed == null) || (NewsIndexPage.Feed.GetModel() == null))
{
RSSViewModel tempModel = null;
if ((tempModel = App.LoadFromIsolatedStorage<RSSViewModel>(Constants.IsolatedStorage_NewsRSSModel)) != null)
{
if (NewsIndexPage.Feed == null)
{
NewsIndexPage.Feed = new Feed.News.NewsFeed(false);
}
NewsIndexPage.Feed.Model = tempModel;
this.isSourceSet = false;
}
}
this.isNewInstance = false;
}
// Set pivotitem Source
if (this.isSourceSet == false)
{
@@ -83,6 +112,20 @@ namespace CampusAppWP8.Pages.News
}
}
/// <summary>
/// Overrides the OnNavigatedFrom function.
/// </summary>
/// <param name="e">event args</param>
protected override void OnNavigatedFrom(NavigationEventArgs e)
{
base.OnNavigatedFrom(e);
if (e.NavigationMode != System.Windows.Navigation.NavigationMode.Back)
{
App.SaveToIsolatedStorage<RSSViewModel>(Constants.IsolatedStorage_NewsRSSModel, NewsIndexPage.GetNewsFeed().GetModel());
}
}
/// <summary>
/// Called when the index of the selected PivotItem is changed.
/// Set the text Grid to visible and the WebBrowser to collapsed.

View File

@@ -7,11 +7,13 @@
//----------------------------------------------------------------------
namespace CampusAppWP8.Pages.Openinghours
{
using System;
using System.Windows.Navigation;
using CampusAppWP8.Feed.Openinghours;
using CampusAppWP8.Model.Openinghours;
using CampusAppWP8.Resources;
using Microsoft.Phone.Controls;
using System;
/// <summary>
/// Opening hours page.
/// </summary>
@@ -24,6 +26,11 @@ namespace CampusAppWP8.Pages.Openinghours
/// </summary>
private OpeninghoursFeed feed = null;
/// <summary>
/// for checking if the instance is new or a tombstone.
/// </summary>
private bool isNewInstance = false;
#endregion
#region Constructor
@@ -41,6 +48,8 @@ namespace CampusAppWP8.Pages.Openinghours
this.feed.onLoaded += new OpeninghoursFeed.OnLoaded(this.FeedIsReady);
this.feed.LoadData();
}
this.isNewInstance = true;
}
#endregion
@@ -62,6 +71,21 @@ namespace CampusAppWP8.Pages.Openinghours
this.ProgressBar.Visibility = System.Windows.Visibility.Visible;
}
*/
if (this.isNewInstance)
{
if ((this.feed == null) || (this.feed.GetModel() == null))
{
OpeninghoursModel tempModel = null;
if ((tempModel = App.LoadFromIsolatedStorage<OpeninghoursModel>(Constants.IsolatedStorage_OpeninghoursModel)) != null)
{
this.feed.Model = tempModel;
this.FeedIsReady();
}
}
this.isNewInstance = false;
}
}
/// <summary>
@@ -71,6 +95,11 @@ namespace CampusAppWP8.Pages.Openinghours
protected override void OnNavigatedFrom(NavigationEventArgs e)
{
this.feed.SaveData();
if (e.NavigationMode != System.Windows.Navigation.NavigationMode.Back)
{
App.SaveToIsolatedStorage<OpeninghoursModel>(Constants.IsolatedStorage_OpeninghoursModel, this.feed.GetModel());
}
}
// protected
@@ -82,18 +111,11 @@ namespace CampusAppWP8.Pages.Openinghours
/// Will be execute if the feed is ready.
/// </summary>
private void FeedIsReady()
{
this.SetupInstitutionList();
//this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed;
//this.feed.SaveData(true);
}
/// <summary>
/// Setup the institution list.
/// </summary>
private void SetupInstitutionList()
{
this.InstitutionPanel.ItemsSource = this.feed.Model.Institutions;
// this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed;
// this.feed.SaveData(true);
}
/// <summary>
@@ -104,11 +126,13 @@ namespace CampusAppWP8.Pages.Openinghours
/// <param name="e">event args</param>
private void OpenHoursForceUpdate_Click(object sender, EventArgs e)
{
//this.ProgressBar.Visibility = System.Windows.Visibility.Visible;
// this.ProgressBar.Visibility = System.Windows.Visibility.Visible;
this.feed.ForceWebUpdate();
}
// private
#endregion
// Method
#endregion
}

View File

@@ -150,6 +150,24 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die IsolatedStorage_DepartmentModel ähnelt.
/// </summary>
public static string IsolatedStorage_DepartmentModel {
get {
return ResourceManager.GetString("IsolatedStorage_DepartmentModel", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die IsolatedStorage_EventRSSModel ähnelt.
/// </summary>
public static string IsolatedStorage_EventRSSModel {
get {
return ResourceManager.GetString("IsolatedStorage_EventRSSModel", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die LectureModel ähnelt.
/// </summary>
@@ -168,6 +186,24 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die IsolatedStorage_NewsRSSModel ähnelt.
/// </summary>
public static string IsolatedStorage_NewsRSSModel {
get {
return ResourceManager.GetString("IsolatedStorage_NewsRSSModel", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die IsolatedStorage_OpeninghoursModel ähnelt.
/// </summary>
public static string IsolatedStorage_OpeninghoursModel {
get {
return ResourceManager.GetString("IsolatedStorage_OpeninghoursModel", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die lsf_auszug ähnelt.
/// </summary>

View File

@@ -251,9 +251,6 @@
</data>
<data name="FileMensa_Shedule" xml:space="preserve">
<value>MensaFeed.xml</value>
</data>
<data name="FileEvents_Name" xml:space="preserve">
<value>EventsFeed.xml</value>
</data>
<data name="FileEvents_Name" xml:space="preserve">
<value>EventsFeed.xml</value>
@@ -276,4 +273,16 @@
<data name="UrlNews_Addr" xml:space="preserve">
<value>http://www.tu-cottbus.de/oracle-gateway/php/rss2feed_aktuelles.php</value>
</data>
<data name="IsolatedStorage_DepartmentModel" xml:space="preserve">
<value>IsolatedStorage_DepartmentModel</value>
</data>
<data name="IsolatedStorage_EventRSSModel" xml:space="preserve">
<value>IsolatedStorage_EventRSSModel</value>
</data>
<data name="IsolatedStorage_NewsRSSModel" xml:space="preserve">
<value>IsolatedStorage_NewsRSSModel</value>
</data>
<data name="IsolatedStorage_OpeninghoursModel" xml:space="preserve">
<value>IsolatedStorage_OpeninghoursModel</value>
</data>
</root>