protected virtual IAsyncOperation <ImageSource> GetThumbAsync() { return(Run <ImageSource>(async token => { await CoreApplication.MainView.Dispatcher.Yield(); var image = new BitmapImage(); if (!await ThumbClient.FetchThumbAsync(this.ThumbUri, image)) { return null; } return image; })); }
internal Gallery( long gid, string error = null, string token = "0", string title = null, string title_jpn = null, string category = null, string thumb = null, string uploader = null, string posted = null, string filecount = null, long filesize = 0, bool expunged = true, string rating = null, string torrentcount = null, string[] tags = null) : this(gid, EToken.Parse(token.CoalesceNullOrWhiteSpace("0")), int.Parse(filecount, NumberStyles.Integer, CultureInfo.InvariantCulture)) { if (error != null) { throw new Exception(error); } Available = !expunged; Title = HtmlEntity.DeEntitize(title); TitleJpn = HtmlEntity.DeEntitize(title_jpn); if (!_CategoriesForRestApi.TryGetValue(category, out var ca)) { ca = Category.Unspecified; } Category = ca; Uploader = HtmlEntity.DeEntitize(uploader); Posted = DateTimeOffset.FromUnixTimeSeconds(long.Parse(posted, NumberStyles.Integer, CultureInfo.InvariantCulture)); FileSize = filesize; Expunged = expunged; Rating.AverageScore = double.Parse(rating, NumberStyles.Number, CultureInfo.InvariantCulture); TorrentCount = int.Parse(torrentcount, NumberStyles.Integer, CultureInfo.InvariantCulture); Tags = new TagCollection(this, tags.Select(tag => Tag.Parse(tag))); ThumbUri = ThumbClient.FormatThumbUri(thumb); }
private static async Task <bool> getThumbRemoteAsync(Gallery gallery, BitmapImage bitmap) { return(await ThumbClient.FetchThumbAsync(gallery.ThumbUri, bitmap)); }