Esempio n. 1
0
 public Task Send(object value)
 {
     return(TaskAsyncHelper.FromMethod((connection, data) => connection.Send(data),
                                       _webSocketConnection,
                                       _serializer.Stringify(value))
            .Catch());
 }
Esempio n. 2
0
        public Task Flush()
        {
#if NET45
            return(ResponseBody.FlushAsync());
#else
            return(TaskAsyncHelper.FromMethod(() => ResponseBody.Flush()));
#endif
        }
 public Task <string> PutBlobStreamAsync(string containerName, string blobName, Stream stream, bool overwrite, string expectedEtag, CancellationToken cancellationToken)
 {
     return(TaskAsyncHelper.FromMethod(
                () =>
     {
         string etag;
         PutBlobStream(containerName, blobName, stream, overwrite, expectedEtag, out etag);
         return etag;
     }));
 }
 public Task <string> PutBlobAsync(string containerName, string blobName, object item, Type type, bool overwrite, string expectedEtag, CancellationToken cancellationToken, IDataSerializer serializer = null)
 {
     return(TaskAsyncHelper.FromMethod(
                () =>
     {
         string etag;
         PutBlob(containerName, blobName, item, type, overwrite, expectedEtag, out etag, serializer);
         return etag;
     }));
 }
 public Task <BlobWithETag <Stream> > GetBlobStreamAsync(string containerName, string blobName, CancellationToken cancellationToken)
 {
     return(TaskAsyncHelper.FromMethod(
                () =>
     {
         string etag;
         var blob = GetBlobStream(containerName, blobName, out etag);
         return blob.Convert(o => new BlobWithETag <Stream> {
             Blob = o, ETag = etag
         }, () => default(BlobWithETag <Stream>));
     }));
 }
 public Task <BlobWithETag <object> > GetBlobAsync(string containerName, string blobName, Type type, CancellationToken cancellationToken, IDataSerializer serializer = null)
 {
     return(TaskAsyncHelper.FromMethod(
                () =>
     {
         string etag;
         var blob = GetBlob(containerName, blobName, type, out etag, serializer);
         return blob.Convert(o => new BlobWithETag <object> {
             Blob = o, ETag = etag
         }, () => default(BlobWithETag <object>));
     }));
 }
 public Task <string> GetBlobEtagAsync(string containerName, string blobName, CancellationToken cancellationToken)
 {
     // TODO: Implement native Task properly using FileSystem async api
     return(TaskAsyncHelper.FromMethod(() => GetBlobEtag(containerName, blobName)));
 }
Esempio n. 8
0
 public Task WriteAsync(string data)
 {
     return(TaskAsyncHelper.FromMethod((response, value) => response.Write(value), _context.Response, data));
 }
 public Task <string> GetBlobEtagAsync(string containerName, string blobName, CancellationToken cancellationToken)
 {
     return(TaskAsyncHelper.FromMethod(() => GetBlobEtag(containerName, blobName)));
 }