public void UpdateFile(File file) { if (_animations.TryGetValue(file.Id, out List <Animation> items) && items.Count > 0) { foreach (var item in items) { item.UpdateFile(file); var container = List.ContainerFromItem(item) as SelectorItem; if (container == null) { continue; } var content = container.ContentTemplateRoot as Border; if (content == null) { continue; } if (content.Child is AnimationView view) { view.Source = new LocalVideoSource(file); _handler.ThrottleVisibleItems(); } } } _zoomer.UpdateFile(file); }
public void UpdateFile(File file) { foreach (Sticker sticker in List.Items) { if (sticker.UpdateFile(file) && file.Local.IsDownloadingCompleted) { if (file.Id == sticker.Thumbnail?.File.Id) { var container = List.ContainerFromItem(sticker) as SelectorItem; if (container == null) { continue; } var content = container.ContentTemplateRoot as Grid; if (content == null) { continue; } var photo = content.Children[0] as Image; photo.Source = PlaceholderHelper.GetWebPFrame(file.Local.Path); } else if (file.Id == sticker.StickerValue.Id) { _handler.ThrottleVisibleItems(); } } } _zoomer.UpdateFile(file); }
public void UpdateFile(File file) { if (_stickers.TryGetValue(file.Id, out List <StickerViewModel> items) && items.Count > 0) { foreach (var item in items) { item.UpdateFile(file); if (item.Thumbnail?.File.Id == file.Id) { var container = Stickers.ContainerFromItem(item) as SelectorItem; if (container == null) { continue; } var content = container.ContentTemplateRoot as Grid; var photo = content.Children[0] as Image; photo.Source = PlaceholderHelper.GetWebPFrame(file.Local.Path); } else if (item.StickerValue.Id == file.Id) { _handler.ThrottleVisibleItems(); } } } if (_stickerSets.TryGetValue(file.Id, out List <StickerSetViewModel> sets) && sets.Count > 0) { foreach (var item in sets) { var cover = item.Thumbnail ?? item.Covers.FirstOrDefault()?.Thumbnail; if (cover == null) { continue; } cover.UpdateFile(file); var container = Toolbar.ContainerFromItem(item) as SelectorItem; if (container == null) { continue; } var content = container.ContentTemplateRoot as Grid; var photo = content?.Children[0] as Image; if (content == null) { continue; } if (item.IsAnimated) { photo.Source = PlaceholderHelper.GetLottieFrame(file.Local.Path, 0, 36, 36); } else { photo.Source = PlaceholderHelper.GetWebPFrame(file.Local.Path); } } } _zoomer.UpdateFile(file); }