示例#1
0
 private BitmapImage LoadEmojiUnlocked(PartialEmoji e)
 {
     try {
         var b = new BitmapImage();
         b.BeginInit();
         b.CacheOption   = BitmapCacheOption.OnLoad;
         b.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
         b.UriSource     = new Uri(FromCache(e));
         b.EndInit();
         return(b);
     } catch {
         return(null);
     }
 }
示例#2
0
        public async Task <BitmapImage> EmojiFromCache(PartialEmoji e)
        {
            if (File.Exists(FromCache(e)))
            {
                return(LoadEmojiUnlocked(e));
            }

            WebClient w = new WebClient();

            try {
                await w.DownloadFileTaskAsync(e.url, FromCache(e));
            } catch (WebException ex) {
                HandleError(ex, "Emoji download");
                return(null);
            }
            return(LoadEmojiUnlocked(e));
        }
示例#3
0
 public string FromCache(PartialEmoji e)
 {
     return(Path.Combine(Cache, e.id + (e.animated ? ".gif" : ".png")));
 }