Exemplo n.º 1
0
        static public IAsyncOperation <HttpRandomAccessStream> CreateAsync(HttpClient client, Uri uri)
        {
            HttpRandomAccessStream randomStream = new HttpRandomAccessStream(client, uri);

            return(AsyncInfo.Run(async(cancellationToken) =>
            {
                await randomStream.SendRequesAsync().ConfigureAwait(false);
                return randomStream;
            }));
        }
Exemplo n.º 2
0
        private async Task <IRandomAccessStreamWithContentType> RequestRandmomAccessStream(Uri uri, HttpMethod method)
        {
            if (uri == null)
            {
                return(null);
            }

            try
            {
                return(await HttpRandomAccessStream.CreateAsync(GetClient(), uri));
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e);
                return(null);
            }
        }