Merge branch 'release/R#125#127' into develmaster
This commit is contained in:
@@ -212,6 +212,7 @@
|
||||
<Compile Include="Utility\Logger.cs" />
|
||||
<Compile Include="Utility\HttpRequest.cs" />
|
||||
<Compile Include="Utility\Lui\Button\GoToMapButton.cs" />
|
||||
<Compile Include="Utility\Lui\Button\UpdateButtonAppBar.cs" />
|
||||
<Compile Include="Utility\Lui\Button\ToggleButton.cs" />
|
||||
<Compile Include="Utility\Lui\Button\NavigateButton.cs" />
|
||||
<Compile Include="Utility\Lui\Button\PhoneButton.cs" />
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace CampusAppWP8.Feed.Link
|
||||
using CampusAppWP8.Model;
|
||||
using CampusAppWP8.Model.Link;
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWP8.Utility;
|
||||
|
||||
/// <summary>
|
||||
/// This Class is for ClubLinkFeeds
|
||||
@@ -26,8 +27,8 @@ namespace CampusAppWP8.Feed.Link
|
||||
public ClubLinkFeed()
|
||||
: base(ModelType.FileAndFeed, Constants.FileLink_ClubLinks, Constants.UrlLink_ClubLinks)
|
||||
{
|
||||
this.isFileUpToDate += new IsFileUpToDate(this.CheckIsFileUpToDate);
|
||||
this.isModelUpToDate += new IsModelUpToDate(this.CheckIsModelUpToDate);
|
||||
this.isFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDateOnLoad);
|
||||
this.isModelUpToDateOnLoad += new IsModelUpToDate(this.CheckIsModelUpToDate);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -58,7 +59,7 @@ namespace CampusAppWP8.Feed.Link
|
||||
/// <param name="model">reference of the FeedModel</param>
|
||||
/// <param name="fileInfo">info about the file</param>
|
||||
/// <returns>true, if file is up-to-date, otherwise false</returns>
|
||||
private bool CheckIsFileUpToDate(LinkListModel model, FileInfo fileInfo)
|
||||
private bool CheckIsFileUpToDateOnLoad(LinkListModel model, FileInfo fileInfo)
|
||||
{
|
||||
DateTime lastModified = fileInfo.LastWriteTime;
|
||||
return this.CheckIsUpToDate(lastModified);
|
||||
@@ -71,16 +72,7 @@ namespace CampusAppWP8.Feed.Link
|
||||
/// <returns>true, if is up-to-date, otherwise false</returns>
|
||||
private bool CheckIsUpToDate(DateTime lastModified)
|
||||
{
|
||||
DateTime temp = lastModified.AddDays(1);
|
||||
|
||||
int diff = temp.CompareTo(DateTime.Now);
|
||||
|
||||
if (diff < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return Utilities.DayDifference(Utilities.DifferenceType.Less, lastModified, 7.0);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace CampusAppWP8.Feed.Link
|
||||
using CampusAppWP8.Model;
|
||||
using CampusAppWP8.Model.Link;
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWP8.Utility;
|
||||
|
||||
/// <summary>
|
||||
/// This Class is for CommonLinkFeeds
|
||||
@@ -26,8 +27,9 @@ namespace CampusAppWP8.Feed.Link
|
||||
public CommonLinkFeed()
|
||||
: base(ModelType.FileAndFeed, Constants.FileLink_CommonLinks, Constants.UrlLink_CommonLinks)
|
||||
{
|
||||
this.isFileUpToDate += new IsFileUpToDate(this.CheckIsFileUpToDate);
|
||||
this.isModelUpToDate += new IsModelUpToDate(this.CheckIsModelUpToDate);
|
||||
this.isFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDateOnLoad);
|
||||
this.isFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDateOnLoad);
|
||||
this.isModelUpToDateOnLoad += new IsModelUpToDate(this.CheckIsModelUpToDate);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -58,7 +60,7 @@ namespace CampusAppWP8.Feed.Link
|
||||
/// <param name="model">reference of the FeedModel</param>
|
||||
/// <param name="fileInfo">info about the file</param>
|
||||
/// <returns>true, if file is up-to-date, otherwise false</returns>
|
||||
private bool CheckIsFileUpToDate(LinkListModel model, FileInfo fileInfo)
|
||||
private bool CheckIsFileUpToDateOnLoad(LinkListModel model, FileInfo fileInfo)
|
||||
{
|
||||
DateTime lastModified = fileInfo.LastWriteTime;
|
||||
return this.CheckIsUpToDate(lastModified);
|
||||
@@ -71,16 +73,7 @@ namespace CampusAppWP8.Feed.Link
|
||||
/// <returns>true, if is up-to-date, otherwise false</returns>
|
||||
private bool CheckIsUpToDate(DateTime lastModified)
|
||||
{
|
||||
DateTime temp = lastModified.AddDays(1);
|
||||
|
||||
int diff = temp.CompareTo(DateTime.Now);
|
||||
|
||||
if (diff < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return Utilities.DayDifference(Utilities.DifferenceType.Less, lastModified, 7.0);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace CampusAppWP8.Feed.Mensa
|
||||
using CampusAppWP8.Model;
|
||||
using CampusAppWP8.Model.Mensa;
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWP8.Utility;
|
||||
|
||||
/// <summary>
|
||||
/// This Class is for MensaFeeds
|
||||
@@ -26,8 +27,8 @@ namespace CampusAppWP8.Feed.Mensa
|
||||
public MensaFeed()
|
||||
: base(ModelType.FileAndFeed, Constants.FileMensa_Shedule, Constants.UrlMensa_Week)
|
||||
{
|
||||
this.isFileUpToDate += new IsFileUpToDate(this.CheckIsFileUpToDate);
|
||||
this.isModelUpToDate += new IsModelUpToDate(this.CheckIsModelUpToDate);
|
||||
this.isFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDateOnLoad);
|
||||
this.isModelUpToDateOnLoad += new IsModelUpToDate(this.CheckIsModelUpToDate);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -58,7 +59,7 @@ namespace CampusAppWP8.Feed.Mensa
|
||||
/// <param name="model">reference of the FeedModel</param>
|
||||
/// <param name="fileInfo">info about the file</param>
|
||||
/// <returns>true, if file is up-to-date, otherwise false</returns>
|
||||
private bool CheckIsFileUpToDate(MenuWeekModel model, FileInfo fileInfo)
|
||||
private bool CheckIsFileUpToDateOnLoad(MenuWeekModel model, FileInfo fileInfo)
|
||||
{
|
||||
DateTime lastModified = fileInfo.LastWriteTime;
|
||||
return this.CheckIsUpToDate(lastModified);
|
||||
@@ -81,6 +82,7 @@ namespace CampusAppWP8.Feed.Mensa
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace CampusAppWP8.Feed.StudentCouncil
|
||||
using CampusAppWP8.Model;
|
||||
using CampusAppWP8.Model.StudentCouncil;
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWP8.Utility;
|
||||
|
||||
/// <summary>
|
||||
/// This Class is for StudentCouncilFeed
|
||||
@@ -26,8 +27,8 @@ namespace CampusAppWP8.Feed.StudentCouncil
|
||||
public StudentCouncilFeed()
|
||||
: base(ModelType.FileAndFeed, Constants.FileStudentCouncil_StudentCouncils, Constants.UrlStudentCouncil_StudentCouncils)
|
||||
{
|
||||
this.isFileUpToDate += new IsFileUpToDate(this.CheckIsFileUpToDate);
|
||||
this.isModelUpToDate += new IsModelUpToDate(this.CheckIsModelUpToDate);
|
||||
this.isFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDateOnLoad);
|
||||
this.isModelUpToDateOnLoad += new IsModelUpToDate(this.CheckIsModelUpToDate);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -58,7 +59,7 @@ namespace CampusAppWP8.Feed.StudentCouncil
|
||||
/// <param name="model">reference of the FeedModel</param>
|
||||
/// <param name="fileInfo">info about the file</param>
|
||||
/// <returns>true, if file is up-to-date, otherwise false</returns>
|
||||
private bool CheckIsFileUpToDate(StudentCouncilListModel model, FileInfo fileInfo)
|
||||
private bool CheckIsFileUpToDateOnLoad(StudentCouncilListModel model, FileInfo fileInfo)
|
||||
{
|
||||
DateTime lastModified = fileInfo.LastWriteTime;
|
||||
return this.CheckIsUpToDate(lastModified);
|
||||
@@ -71,16 +72,7 @@ namespace CampusAppWP8.Feed.StudentCouncil
|
||||
/// <returns>true, if is up-to-date, otherwise false</returns>
|
||||
private bool CheckIsUpToDate(DateTime lastModified)
|
||||
{
|
||||
DateTime temp = lastModified.AddDays(1);
|
||||
|
||||
int diff = temp.CompareTo(DateTime.Now);
|
||||
|
||||
if (diff < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return Utilities.DayDifference(Utilities.DifferenceType.Less, lastModified, 7.0);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -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>
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
@@ -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
|
||||
@@ -66,6 +67,15 @@ namespace CampusAppWP8.Pages.Links
|
||||
this.clubLinkFeed.LoadData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Override the OnNavigatedTo method
|
||||
/// </summary>
|
||||
/// <param name="e">Arguments of navigation</param>
|
||||
protected override void OnNavigatedFrom(NavigationEventArgs e)
|
||||
{
|
||||
this.clubLinkFeed.SaveData();
|
||||
this.commonLinkFeed.SaveData();
|
||||
}
|
||||
#endregion
|
||||
#region private
|
||||
|
||||
@@ -113,8 +123,9 @@ namespace CampusAppWP8.Pages.Links
|
||||
|
||||
if (this.loadingFeeds < 1)
|
||||
{
|
||||
this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed;
|
||||
this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -127,7 +138,7 @@ namespace CampusAppWP8.Pages.Links
|
||||
if (this.loadingFeeds < 1)
|
||||
{
|
||||
this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -146,6 +157,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
|
||||
|
||||
@@ -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"
|
||||
mc:Ignorable="d"
|
||||
FontFamily="{StaticResource PhoneFontFamilyNormal}"
|
||||
FontSize="{StaticResource PhoneFontSizeNormal}"
|
||||
@@ -137,4 +138,9 @@
|
||||
</phone:Pivot>
|
||||
<!-- <Image Source="/Assets/AlignmentGrid.png" VerticalAlignment="Top" Height="800" Width="480" Margin="0,-32,0,0" Grid.Row="0" Grid.RowSpan="2" IsHitTestVisible="False" /> -->
|
||||
</Grid>
|
||||
<phone:PhoneApplicationPage.ApplicationBar>
|
||||
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="False" Mode="Minimized" Opacity="1.0" >
|
||||
<lui:UpdateButtonAppBar Click="MensaForceUpdate_Click"/>
|
||||
</shell:ApplicationBar>
|
||||
</phone:PhoneApplicationPage.ApplicationBar>
|
||||
</phone:PhoneApplicationPage>
|
||||
@@ -88,6 +88,7 @@ namespace CampusAppWP8.Pages.Mensa
|
||||
{
|
||||
this.SetupMensaPivot();
|
||||
this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed;
|
||||
this.feed.SaveData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -130,7 +131,21 @@ namespace CampusAppWP8.Pages.Mensa
|
||||
|
||||
this.selectedIndex = todayIndex;
|
||||
}
|
||||
|
||||
/// <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 MensaForceUpdate_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.ProgressBar.Visibility = System.Windows.Visibility.Visible;
|
||||
this.feed.ForceWebUpdate();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
@@ -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.
|
||||
@@ -83,6 +84,7 @@ namespace CampusAppWP8.Pages.Openinghours
|
||||
{
|
||||
this.SetupInstitutionList();
|
||||
this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed;
|
||||
this.feed.SaveData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -93,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
|
||||
|
||||
@@ -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>
|
||||
@@ -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
|
||||
@@ -77,6 +78,7 @@ namespace CampusAppWP8.Pages.StudentCouncil
|
||||
{
|
||||
this.SetupStudentCouncilPivot();
|
||||
this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed;
|
||||
this.feed.SaveData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -87,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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,13 +17,12 @@ namespace CampusAppWP8.Utility
|
||||
/// </summary>
|
||||
public class HttpRequest
|
||||
{
|
||||
#region Members
|
||||
#region Member
|
||||
|
||||
/// <summary>
|
||||
/// the WebClient, which send the requests
|
||||
/// BaseAddress of the webclient
|
||||
/// </summary>
|
||||
private WebClient client;
|
||||
|
||||
private string baseAddress;
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
@@ -33,7 +32,6 @@ namespace CampusAppWP8.Utility
|
||||
/// </summary>
|
||||
public HttpRequest()
|
||||
{
|
||||
this.client = new WebClient();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -42,8 +40,7 @@ namespace CampusAppWP8.Utility
|
||||
/// <param name="apiBaseAddress">the url of the HttpRequest base address</param>
|
||||
public HttpRequest(Uri apiBaseAddress)
|
||||
{
|
||||
this.client = new WebClient();
|
||||
this.client.BaseAddress = apiBaseAddress.AbsoluteUri;
|
||||
baseAddress = apiBaseAddress.AbsoluteUri;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -58,8 +55,9 @@ namespace CampusAppWP8.Utility
|
||||
/// <param name="action">callback method</param>
|
||||
public void HttpGet(Uri url, Action<object, DownloadStringCompletedEventArgs> action)
|
||||
{
|
||||
this.client.DownloadStringCompleted += new DownloadStringCompletedEventHandler(action);
|
||||
this.client.DownloadStringAsync(url);
|
||||
WebClient client = new WebClient();
|
||||
client.DownloadStringCompleted += new DownloadStringCompletedEventHandler(action);
|
||||
client.DownloadStringAsync(url);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -75,7 +73,7 @@ namespace CampusAppWP8.Utility
|
||||
paramterStr += parameter.ToString();
|
||||
}
|
||||
|
||||
string getUrlStr = this.client.BaseAddress + "?" + paramterStr;
|
||||
string getUrlStr = baseAddress + "?" + paramterStr;
|
||||
return new Uri(getUrlStr, UriKind.Absolute);
|
||||
}
|
||||
|
||||
@@ -190,8 +188,9 @@ namespace CampusAppWP8.Utility
|
||||
/// <param name="data">Data which are sending to the HttpRequest</param>
|
||||
private void UploadData(Uri url, Action<object, UploadStringCompletedEventArgs> action, string method, string data)
|
||||
{
|
||||
this.client.UploadStringCompleted += new UploadStringCompletedEventHandler(action);
|
||||
this.client.UploadStringAsync(url, method, data);
|
||||
WebClient client = new WebClient();
|
||||
client.UploadStringCompleted += new UploadStringCompletedEventHandler(action);
|
||||
client.UploadStringAsync(url, method, data);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="UpdateButtonAppBar.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>22.07.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Utility.Lui.Button
|
||||
{
|
||||
using System;
|
||||
using System.Windows;
|
||||
using CampusAppWP8.Resources;
|
||||
using Microsoft.Phone.Shell;
|
||||
|
||||
/// <summary>
|
||||
/// This class create an Button which start the Email-Client
|
||||
/// </summary>
|
||||
public class UpdateButtonAppBar : ApplicationBarIconButton
|
||||
{
|
||||
#region Members
|
||||
|
||||
/// <summary>
|
||||
/// IconUri of the Button
|
||||
/// </summary>
|
||||
private static Uri iconUri = new Uri(Icons.Update, UriKind.Relative);
|
||||
|
||||
/// <summary>
|
||||
/// Text of the Button
|
||||
/// </summary>
|
||||
private static string text = AppResources.UpdateBtn;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UpdateButtonAppBar" /> class.
|
||||
/// </summary>
|
||||
public UpdateButtonAppBar()
|
||||
: base()
|
||||
{
|
||||
this.IconUri = UpdateButtonAppBar.iconUri;
|
||||
this.Text = UpdateButtonAppBar.text;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user