private void UnloadAtIndex(int index) { if (index == 0 && EmojisRoot != null) { EmojisRoot.Deactivate(); UnloadObject(EmojisRoot); } else if (index == 1 && AnimationsRoot != null) { var viewModel = AnimationsRoot.DataContext as AnimationDrawerViewModel; AnimationsRoot.Deactivate(); UnloadObject(AnimationsRoot); if (viewModel != null) { viewModel.Search(string.Empty); } } else if (index == 2 && StickersRoot != null) { var viewModel = StickersRoot.DataContext as StickerDrawerViewModel; StickersRoot.Deactivate(); UnloadObject(StickersRoot); if (viewModel != null) { viewModel.Search(string.Empty); } } }
private void LoadAtIndex(Chat chat, int index, bool unload) { if (index == 0) { if (unload) { UnloadAtIndex(1); UnloadAtIndex(2); } if (EmojisRoot == null) { FindName(nameof(EmojisRoot)); EmojisRoot.DataContext = EmojiDrawerViewModel.GetForCurrentView(ViewModel.SessionId); } EmojisRoot.Activate(chat); SettingsService.Current.Stickers.SelectedTab = StickersTab.Emoji; } else if (index == 1) { if (unload) { UnloadAtIndex(0); UnloadAtIndex(2); } if (AnimationsRoot == null) { FindName(nameof(AnimationsRoot)); AnimationsRoot.DataContext = AnimationDrawerViewModel.GetForCurrentView(ViewModel.SessionId); AnimationsRoot.ItemClick = Animations_ItemClick; AnimationsRoot.ItemContextRequested += (s, args) => AnimationContextRequested?.Invoke(s, args); } AnimationsRoot.Activate(chat); SettingsService.Current.Stickers.SelectedTab = StickersTab.Animations; } else if (index == 2) { if (unload) { UnloadAtIndex(0); UnloadAtIndex(1); } if (StickersRoot == null) { FindName(nameof(StickersRoot)); StickersRoot.DataContext = StickerDrawerViewModel.GetForCurrentView(ViewModel.SessionId); StickersRoot.ItemClick = Stickers_ItemClick; StickersRoot.ItemContextRequested += (s, args) => StickerContextRequested?.Invoke(s, args); StickersRoot.ChoosingItem += (s, args) => ChoosingSticker?.Invoke(s, args); } StickersRoot.Activate(chat); SettingsService.Current.Stickers.SelectedTab = StickersTab.Stickers; } }
public void UpdateFile(File file) { if (!file.Local.IsDownloadingCompleted) { return; } StickersRoot.UpdateFile(file); AnimationsRoot.UpdateFile(file); }