finish #127
This commit is contained in:
@@ -67,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
|
||||
|
||||
@@ -114,9 +123,9 @@ namespace CampusAppWP8.Pages.Links
|
||||
|
||||
if (this.loadingFeeds < 1)
|
||||
{
|
||||
this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed;
|
||||
this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed;
|
||||
}
|
||||
this.commonLinkFeed.SaveData();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -129,8 +138,7 @@ namespace CampusAppWP8.Pages.Links
|
||||
if (this.loadingFeeds < 1)
|
||||
{
|
||||
this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed;
|
||||
}
|
||||
this.clubLinkFeed.SaveData();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user