Merge branch 'hotfix/#123' into develmaster
Conflicts: CampusAppWP8/CampusAppWP8/Pages/Openinghours/OpeninghoursPage.xaml.cs
This commit is contained in:
@@ -313,10 +313,13 @@ namespace CampusAppWP8
|
||||
/// <summary>
|
||||
/// Save the model data if necessary.
|
||||
/// </summary>
|
||||
public void SaveData()
|
||||
/// <param name="force">force saving. DEFAULT: false</param>
|
||||
public void SaveData(bool force = false)
|
||||
{
|
||||
if ((this.file != null)
|
||||
&& ((this.isFileUpToDateOnSave == null) || (this.isFileUpToDateOnSave(this.model, this.file.GetFileInfo()) == false)))
|
||||
&& ((this.isFileUpToDateOnSave == null)
|
||||
|| (this.isFileUpToDateOnSave(this.model, this.file.GetFileInfo()) == false)
|
||||
|| (force == true)))
|
||||
{
|
||||
if (this.onSaving != null)
|
||||
{
|
||||
@@ -324,6 +327,7 @@ namespace CampusAppWP8
|
||||
}
|
||||
|
||||
byte[] data = this.SerializeModel();
|
||||
string test = Encoding.UTF8.GetString(data, 0, data.Length);
|
||||
this.file.WriteFile(data);
|
||||
|
||||
if (this.onSaved != null)
|
||||
|
||||
@@ -28,9 +28,7 @@ namespace CampusAppWP8.Model.Openinghours
|
||||
/// <summary>
|
||||
/// Gets or sets feed information item list.
|
||||
/// </summary>
|
||||
[XmlArray("data")]
|
||||
[XmlArrayItem("institution")]
|
||||
public ObservableCollection<OpeninghoursInstitutionModel> institutions { get; set; }
|
||||
private ObservableCollection<OpeninghoursInstitutionModel> institutions;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -41,6 +39,7 @@ namespace CampusAppWP8.Model.Openinghours
|
||||
/// </summary>
|
||||
public OpeninghoursModel()
|
||||
{
|
||||
this.institutions = new ObservableCollection<OpeninghoursInstitutionModel>();
|
||||
this.createTime = DateTime.Now;
|
||||
}
|
||||
|
||||
@@ -62,18 +61,21 @@ namespace CampusAppWP8.Model.Openinghours
|
||||
/// <summary>
|
||||
/// Gets the Institutions.
|
||||
/// </summary>
|
||||
[XmlArray("data")]
|
||||
[XmlArrayItem("institution")]
|
||||
public ObservableCollection<OpeninghoursInstitutionModel> Institutions
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.institutions;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.institutions = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Method
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,13 @@ namespace CampusAppWP8.Pages.Openinghours
|
||||
public OpeninghoursPage()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
this.InitializeFeed();
|
||||
|
||||
if (this.feed == null)
|
||||
{
|
||||
this.feed = new OpeninghoursFeed();
|
||||
this.feed.onLoaded += new OpeninghoursFeed.OnLoaded(this.FeedIsReady);
|
||||
this.feed.LoadData();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -50,17 +56,12 @@ namespace CampusAppWP8.Pages.Openinghours
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
base.OnNavigatedTo(e);
|
||||
if (this.feed == null)
|
||||
{
|
||||
this.InitializeFeed();
|
||||
}
|
||||
|
||||
/*
|
||||
if (e.NavigationMode != System.Windows.Navigation.NavigationMode.Back)
|
||||
{
|
||||
this.ProgressBar.Visibility = System.Windows.Visibility.Visible;
|
||||
}
|
||||
|
||||
this.feed.LoadData();
|
||||
*/
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -77,22 +78,14 @@ namespace CampusAppWP8.Pages.Openinghours
|
||||
|
||||
#region private
|
||||
|
||||
/// <summary>
|
||||
/// Initialize the opening hours feed.
|
||||
/// </summary>
|
||||
private void InitializeFeed()
|
||||
{
|
||||
this.feed = new OpeninghoursFeed();
|
||||
this.feed.onLoaded += new OpeninghoursFeed.OnLoaded(this.FeedIsReady);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Will be execute if the feed is ready.
|
||||
/// </summary>
|
||||
private void FeedIsReady()
|
||||
{
|
||||
this.SetupInstitutionList();
|
||||
this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed;
|
||||
//this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed;
|
||||
//this.feed.SaveData(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -111,7 +104,7 @@ 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
|
||||
|
||||
Reference in New Issue
Block a user