C# Class UwpHelpers.Controls.Extensions.HttpClientExtensions

A set of extension methods for System.Net.Http.HttpClient. These can be used in PCLs (e.g. Xamarin apps). Note- Windows.Web.Http.HttpClient has support for Progress. If you do not need System.Net.Http, investigate the possibility of using Windows.Web.Http
Mostra file Open project: LanceMcCarthy/UwpProjects

Public Methods

Method Description
DownloadStreamWithProgressAsync ( this client, string url, IProgress progessReporter ) : Task

Stand-in replacement for HttpClient.GetStreamAsync that can report download progress.

DownloadStringWithProgressAsync ( this client, string url, IProgress progessReporter ) : Task

Stand-in replacement for HttpClient.GetStringAsync that can report download progress.

SendImageDataWithDownloadProgressAsync ( this client, StorageFile imageFile, string url, string parameterName, IProgress progessReporter ) : Task

Helper method to POST binary image data to an API endpoint that expects the data to be accompanied by a parameter

Method Details

DownloadStreamWithProgressAsync() public static method

Stand-in replacement for HttpClient.GetStreamAsync that can report download progress.
public static DownloadStreamWithProgressAsync ( this client, string url, IProgress progessReporter ) : Task
client this HttpClient instance
url string Url of where to download the stream from
progessReporter IProgress Progress reporter to track progress of the download operation
return Task

DownloadStringWithProgressAsync() public static method

Stand-in replacement for HttpClient.GetStringAsync that can report download progress.
public static DownloadStringWithProgressAsync ( this client, string url, IProgress progessReporter ) : Task
client this HttpClient instance
url string Url of where to download the stream from
progessReporter IProgress Progress reporter to track progress of the download operation
return Task

SendImageDataWithDownloadProgressAsync() public static method

Helper method to POST binary image data to an API endpoint that expects the data to be accompanied by a parameter
public static SendImageDataWithDownloadProgressAsync ( this client, StorageFile imageFile, string url, string parameterName, IProgress progessReporter ) : Task
client this HttpClient instance
imageFile Windows.Storage.StorageFile Valie StorageFile of the image
url string The API's http or https endpoint
parameterName string The name of the parameter the API expects the image data in
progessReporter IProgress Progress reporter to track progress of the download operation
return Task