示例#1
0
 public async Task SaveAsAsync(Uri source, string filepath)
 {
     try
     {
         var client = new CachedWebClient();
         await client.SaveAsAsync(source.AbsoluteUri, filepath);
     }
     catch (AggregateException e)
     {
         foreach (var ie in e.InnerExceptions)
         {
             throw ie;
         }
     }
 }
示例#2
0
 public async Task SaveAsAsync(Uri source, string filepath)
 {
     try
     {
         var client = new CachedWebClient();
         await client.SaveAsAsync(source.AbsoluteUri, filepath);
     }
     catch (AggregateException e)
     {
         var logger = DI.Resolve <ILogger>();
         logger.Print("SaveAsAsync", e);
         foreach (var ie in e.InnerExceptions)
         {
             logger.Print("SaveAsAsync", e);
             throw ie;
         }
     }
 }
示例#3
0
        public async Task <ITwitterImage> Download(SizeOpt size = SizeOpt.Small)
        {
            var client = new CachedWebClient();

            try
            {
                Data = await client.DownloadDataAsync(ToUri(size));

                return(this);
            }
            catch (WebException e)
            {
                Data = null;

                var logger = DI.Resolve <ILogger>();
                logger.Print("Download Failed.", e);

                return(this);
            }
        }