public virtual Task <Stream> GetImageStreamAsync(Guid id) { var webClient = new NativeHttpClient(this.httpClientConfiguration); webClient .AssignAgent(this.device) .AssignAcceptTypeJson() .AssignAuthToken(this.serviceApi.Map); return(webClient.GetStreamAsync(this.serviceApi.ImageUriBase + id)); }
public async void Download(IOListing io, Action <ResultState> complete) { var webClient = new NativeHttpClient(this.httpClientConfiguration); webClient .AssignAgent(this.device); var stream = await webClient.GetStreamAsync(io.Url); await this.WriteFileAsync(this.Map(io.FullPath), stream); complete.Invoke(ResultState.Success); }
public void Start() { try { var webClient = new NativeHttpClient(this.httpClientConfiguration); webClient .AssignAgent(this.device) .AssignAuthToken(this.serviceApi.News); webClient.GetStreamAsync(this.Url).ContinueWith(task => this.ProcessResponse(task.Result)); } catch (Exception e) { this.FireDownloadFailed(e); } }