public PopularVM() { this.Refresh = new Command(() => this.Galleries.Clear()); this.Open = new Command <Gallery>(g => { GalleryVM.GetVM(g); RootControl.RootController.Frame.Navigate(typeof(GalleryPage), g.ID); }, g => g != null); }
protected SearchResultVM() { this.Open = new Command <Gallery>(g => { this.SelectedGallery = g; GalleryVM.GetVM(g); RootControl.RootController.Frame.Navigate(typeof(GalleryPage), g.ID); }, g => g != null); }
protected GalleryListVM() { this.Delete = new Command <Gallery>(async g => { await g.DeleteAsync(); this.Galleries?.Remove(g); RootControl.RootController.SendToast(Strings.Resources.Views.CachedPage.GalleryDeleted, null); }, g => g != null); this.Open = new Command <Gallery>(g => { GalleryVM.GetVM(g); RootControl.RootController.Frame.Navigate(typeof(GalleryPage), g.ID); }, g => g != null); }
public InfoVM() { this.RefreshStatus = new AsyncCommand(() => Status.RefreshAsync().AsTask(), () => Status != null); this.RefreshTaggingStatistics = new AsyncCommand(() => TaggingStatistics.RefreshAsync().AsTask(), () => TaggingStatistics != null); this.OpenGallery = new Command <TaggingRecord>(tr => { RootControl.RootController.TrackAsyncAction(GalleryVM.GetVMAsync(tr.GalleryInfo).AsAsyncAction(), (s, e) => { RootControl.RootController.Frame.Navigate(typeof(GalleryPage), tr.GalleryInfo.ID); }); }, tr => tr.GalleryInfo.ID > 0); this.SearchTag = new Command <TaggingRecord>(tr => { var vm = SearchVM.GetVM(tr.Tag.Search(Category.All, new AdvancedSearchOptions(skipMasterTags: true, searchLowPowerTags: true))); RootControl.RootController.Frame.Navigate(typeof(SearchPage), vm.SearchQuery.ToString()); }, tr => tr.Tag.Content != null); }
public static GalleryVM GetVM(Gallery gallery) { var gi = new GalleryInfo(gallery.ID, gallery.Token); if (Cache.TryGet(gi, out var vm)) { vm.Gallery = gallery; if (gallery.Count <= vm.currentIndex) { vm.currentIndex = -1; } } else { vm = new GalleryVM(gallery); Cache.Add(gi, vm); } return(vm); }