This commit is contained in:
stubbfel
2013-07-22 18:32:01 +02:00
parent 9662be5632
commit 970c6ce8e8
10 changed files with 84 additions and 7 deletions

View File

@@ -28,6 +28,7 @@ namespace CampusAppWP8.Feed.Link
: base(ModelType.FileAndFeed, Constants.FileLink_CommonLinks, Constants.UrlLink_CommonLinks)
{
this.isFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDateOnLoad);
this.isFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDateOnLoad);
this.isModelUpToDateOnLoad += new IsModelUpToDate(this.CheckIsModelUpToDate);
}

View File

@@ -6,6 +6,7 @@
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:lui="clr-namespace:CampusAppWP8.Utility.Lui.Button"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
@@ -74,4 +75,9 @@
</ListBox.ItemTemplate>
</ListBox>
</Grid>
<phone:PhoneApplicationPage.ApplicationBar>
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="False" Mode="Minimized" Opacity="1.0" >
<lui:UpdateButtonAppBar Click="DeptForceUpdate_Click"/>
</shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>
</phone:PhoneApplicationPage>

View File

@@ -156,5 +156,16 @@ namespace CampusAppWP8.Pages.Departments
NavigationService.Navigate(new Uri(Constants.PathDepartment_DepartmentPage + "?pivotindex=" + tempElem.Tag, UriKind.Relative));
}
/// <summary>
/// On clicking the update button in the ApplicationBar.
/// Force a data update from the web.
/// </summary>
/// <param name="sender">button object</param>
/// <param name="e">event args</param>
private void DeptForceUpdate_Click(object sender, EventArgs e)
{
DepartmentIndexPage.feed.ForceWebUpdate();
}
}
}

View File

@@ -58,5 +58,9 @@
</phone:PivotItem>
</phone:Pivot>
</Grid>
<phone:PhoneApplicationPage.ApplicationBar>
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="False" Mode="Minimized" Opacity="1.0" >
<lui:UpdateButtonAppBar Click="LinkForceUpdate_Click"/>
</shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>
</phone:PhoneApplicationPage>

View File

@@ -10,6 +10,7 @@ namespace CampusAppWP8.Pages.Links
using System.Windows.Navigation;
using CampusAppWP8.Feed.Link;
using Microsoft.Phone.Controls;
using System;
/// <summary>
/// Class for the LinkPage
@@ -148,6 +149,19 @@ namespace CampusAppWP8.Pages.Links
this.ClubLinkPanel.ItemsSource = this.clubLinkFeed.Model.Links;
}
/// <summary>
/// On clicking the update button in the ApplicationBar.
/// Force a data update from the web.
/// </summary>
/// <param name="sender">button object</param>
/// <param name="e">event args</param>
private void LinkForceUpdate_Click(object sender, EventArgs e)
{
this.loadingFeeds = 2;
this.ProgressBar.Visibility = System.Windows.Visibility.Visible;
this.commonLinkFeed.ForceWebUpdate();
this.clubLinkFeed.ForceWebUpdate();
}
#endregion
#endregion

View File

@@ -126,5 +126,9 @@
</ListBox.ItemTemplate>
</ListBox>
</Grid>
<phone:PhoneApplicationPage.ApplicationBar>
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="False" Mode="Minimized" Opacity="1.0" >
<lui:UpdateButtonAppBar Click="OpenHoursForceUpdate_Click"/>
</shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>
</phone:PhoneApplicationPage>

View File

@@ -10,6 +10,7 @@ namespace CampusAppWP8.Pages.Openinghours
using System.Windows.Navigation;
using CampusAppWP8.Feed.Openinghours;
using Microsoft.Phone.Controls;
using System;
/// <summary>
/// Opening hours page.
@@ -94,6 +95,17 @@ namespace CampusAppWP8.Pages.Openinghours
this.InstitutionPanel.ItemsSource = this.feed.Model.Institutions;
}
/// <summary>
/// On clicking the update button in the ApplicationBar.
/// Force a data update from the web.
/// </summary>
/// <param name="sender">button object</param>
/// <param name="e">event args</param>
private void OpenHoursForceUpdate_Click(object sender, EventArgs e)
{
this.ProgressBar.Visibility = System.Windows.Visibility.Visible;
this.feed.ForceWebUpdate();
}
// private
#endregion
// Method

View File

@@ -52,5 +52,9 @@
</phone:Pivot.ItemTemplate>
</phone:Pivot>
</Grid>
<phone:PhoneApplicationPage.ApplicationBar>
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="False" Mode="Minimized" Opacity="1.0" >
<lui:UpdateButtonAppBar Click="StudentForceUpdate_Click"/>
</shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>
</phone:PhoneApplicationPage>

View File

@@ -10,6 +10,7 @@ namespace CampusAppWP8.Pages.StudentCouncil
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using CampusAppWP8.Feed.StudentCouncil;
using System;
/// <summary>
/// Class for the StudentCouncilPage
@@ -88,6 +89,18 @@ namespace CampusAppWP8.Pages.StudentCouncil
this.StudentCouncilPivot.ItemsSource = this.feed.Model.GetStudentCouncilsGroupByFaculty();
}
/// <summary>
/// On clicking the update button in the ApplicationBar.
/// Force a data update from the web.
/// </summary>
/// <param name="sender">button object</param>
/// <param name="e">event args</param>
private void StudentForceUpdate_Click(object sender, EventArgs e)
{
this.ProgressBar.Visibility = System.Windows.Visibility.Visible;
this.feed.ForceWebUpdate();
}
#endregion
#endregion

View File

@@ -220,11 +220,19 @@ namespace CampusAppWP8.Utility
/// <param name="data">data array</param>
private async void WriteAsync(byte[] data)
{
var file = await File.LocalFolder.CreateFileAsync(this.filename, CreationCollisionOption.ReplaceExisting);
using (var s = await file.OpenStreamForWriteAsync())
try
{
await s.WriteAsync(data, 0, data.Length);
var file = await File.LocalFolder.CreateFileAsync(this.filename, CreationCollisionOption.ReplaceExisting);
using (var s = await file.OpenStreamForWriteAsync())
{
await s.WriteAsync(data, 0, data.Length);
}
}
catch (Exception e)
{
// log write Error
Logger.LogException(e);
}
}
}