示例#1
0
 private void RegisterCommands()
 {
     AboutSunctumCommand = new DelegateCommand(() =>
     {
         OpenVersionDialog();
     });
     ClearSearchResultCommand = new DelegateCommand(() =>
     {
         ActiveDocumentViewModel.BookCabinet.ClearSearchResult();
     });
     DisplaySideBySideCommand = new DelegateCommand(() =>
     {
         ActiveDocumentViewModel.BookCabinet.DisplayType = Domain.Logic.DisplayType.DisplayType.SideBySide;
     });
     DetailsCommand = new DelegateCommand(() =>
     {
         ActiveDocumentViewModel.BookCabinet.DisplayType = Domain.Logic.DisplayType.DisplayType.Details;
     });
     EncryptionStartingCommand = new DelegateCommand(async() =>
     {
         await OpenEncryptionStartingDialog();
     });
     ExitApplicationCommand = new DelegateCommand(() =>
     {
         Close();
     });
     GeneralCancelCommand = new DelegateCommand(() =>
     {
         GeneralCancel();
     });
     ImportFilesCommand = new DelegateCommand(async() =>
     {
         await OpenImportFileDialogThenImport();
     });
     ImportFoldersCommand = new DelegateCommand(async() =>
     {
         await OpenImportFolderDialogThenImport();
     });
     ImportLibraryCommand = new DelegateCommand(async() =>
     {
         await OpenImportLibraryDialog();
     });
     OpenAuthorManagementDialogCommand = new DelegateCommand(() =>
     {
         OpenAuthorManagementDialog();
     });
     OpenMetadataImportSettingDialogCommand = new DelegateCommand(() =>
     {
         OpenMetadataImportSettingDialog();
     });
     OpenPowerSearchCommand = new DelegateCommand(() =>
     {
         IDialogResult result = new Prism.Services.Dialogs.DialogResult();
         DialogService.ShowDialog(nameof(PowerSearch), new DialogParameters()
         {
             { "Storage", ActiveDocumentViewModel.BookCabinet }
         }, ret => result = ret);
     });
     OpenStatisticsDialogCommand = new DelegateCommand(() =>
     {
         DialogService.ShowDialog(nameof(Views.Statistics));
     });
     OpenSwitchLibraryCommand = new DelegateCommand(async() =>
     {
         bool changed = OpenSwitchLibraryDialogAndChangeWorkingDirectory();
         if (changed)
         {
             CloseAllTab();
             await LibraryVM.Reset();
             await Initialize(false);
         }
     });
     OpenSearchPaneCommand = new DelegateCommand(() =>
     {
         this.ActiveDocumentViewModel.SearchPaneIsVisible = true;
     });
     OpenTagManagementDialogCommand = new DelegateCommand(() =>
     {
         OpenTagManagementDialog();
     });
     ReloadLibraryCommand = new DelegateCommand(async() =>
     {
         CloseAllTab();
         await LibraryVM.Reset();
         await Initialize(false);
     });
     ShowPreferenceDialogCommand = new DelegateCommand(() =>
     {
         ShowPreferenceDialog();
     });
     ShowDuplicateBooksCommand = new DelegateCommand(() =>
     {
         this.NewSearchTab(new ObservableCollection <BookViewModel>(BookFacade.FindDuplicateFingerPrint()));
     });
     SortBookByAuthorAscCommand = new DelegateCommand(() =>
     {
         ActiveDocumentViewModel.BookCabinet.Sorting = BookSorting.ByAuthorAsc;
     });
     SortBookByAuthorDescCommand = new DelegateCommand(() =>
     {
         ActiveDocumentViewModel.BookCabinet.Sorting = BookSorting.ByAuthorDesc;
     });
     SortBookByCoverBlueAscCommand = new DelegateCommand(() =>
     {
         ActiveDocumentViewModel.BookCabinet.Sorting = BookSorting.ByCoverBlueAsc;
     });
     SortBookByCoverBlueDescCommand = new DelegateCommand(() =>
     {
         ActiveDocumentViewModel.BookCabinet.Sorting = BookSorting.ByCoverBlueDesc;
     });
     SortBookByCoverGreenAscCommand = new DelegateCommand(() =>
     {
         ActiveDocumentViewModel.BookCabinet.Sorting = BookSorting.ByCoverGreenAsc;
     });
     SortBookByCoverGreenDescCommand = new DelegateCommand(() =>
     {
         ActiveDocumentViewModel.BookCabinet.Sorting = BookSorting.ByCoverGreenDesc;
     });
     SortBookByCoverRedAscCommand = new DelegateCommand(() =>
     {
         ActiveDocumentViewModel.BookCabinet.Sorting = BookSorting.ByCoverRedAsc;
     });
     SortBookByCoverRedDescCommand = new DelegateCommand(() =>
     {
         ActiveDocumentViewModel.BookCabinet.Sorting = BookSorting.ByCoverRedDesc;
     });
     SortBookByLoadedAscCommand = new DelegateCommand(() =>
     {
         ActiveDocumentViewModel.BookCabinet.Sorting = BookSorting.ByLoadedAsc;
     });
     SortBookByLoadedDescCommand = new DelegateCommand(() =>
     {
         ActiveDocumentViewModel.BookCabinet.Sorting = BookSorting.ByLoadedDesc;
     });
     SortBookByTitleAscCommand = new DelegateCommand(() =>
     {
         ActiveDocumentViewModel.BookCabinet.Sorting = BookSorting.ByTitleAsc;
     });
     SortBookByTitleDescCommand = new DelegateCommand(() =>
     {
         ActiveDocumentViewModel.BookCabinet.Sorting = BookSorting.ByTitleDesc;
     });
     SortBookByFingerPrintAscCommand = new DelegateCommand(() =>
     {
         ActiveDocumentViewModel.BookCabinet.Sorting = BookSorting.ByFingerPrintAsc;
     });
     SortBookByFingerPrintDescCommand = new DelegateCommand(() =>
     {
         ActiveDocumentViewModel.BookCabinet.Sorting = BookSorting.ByFingerPrintDesc;
     });
     SwitchLibraryCommand = new DelegateCommand <RecentOpenedLibrary>(async(p) =>
     {
         await LibraryVM.Reset();
         Configuration.ApplicationConfiguration.WorkingDirectory = p.Path;
         Configuration.Save(Configuration.ApplicationConfiguration);
         await Initialize(false);
     });
     ToggleDisplayAuthorPaneCommand = new DelegateCommand(() =>
     {
         DisplayAuthorPane = !DisplayAuthorPane;
         if (DisplayAuthorPane)
         {
             if (!DockingPaneViewModels.Contains((PaneViewModelBase)AuthorPaneViewModel))
             {
                 DockingPaneViewModels.Add((PaneViewModelBase)AuthorPaneViewModel);
             }
         }
         else
         {
             DockingPaneViewModels.Remove((PaneViewModelBase)AuthorPaneViewModel);
         }
     });
     ToggleDisplayInformationPaneCommand = new DelegateCommand(() =>
     {
         DisplayInformationPane = !DisplayInformationPane;
         if (DisplayInformationPane)
         {
             if (!DockingPaneViewModels.Contains((PaneViewModelBase)InformationPaneViewModel))
             {
                 DockingPaneViewModels.Add((PaneViewModelBase)InformationPaneViewModel);
             }
         }
         else
         {
             DockingPaneViewModels.Remove((PaneViewModelBase)InformationPaneViewModel);
         }
     });
     ToggleDisplayTagPaneCommand = new DelegateCommand(() =>
     {
         DisplayTagPane = !DisplayTagPane;
         if (DisplayTagPane)
         {
             if (!DockingPaneViewModels.Contains((PaneViewModelBase)TagPaneViewModel))
             {
                 DockingPaneViewModels.Add((PaneViewModelBase)TagPaneViewModel);
             }
         }
         else
         {
             DockingPaneViewModels.Remove((PaneViewModelBase)TagPaneViewModel);
         }
     });
     UnencryptionStartingCommand = new DelegateCommand(async() =>
     {
         await OpenUnencryptingDialog();
     });
     UpdateBookByteSizeAllCommand = new DelegateCommand(async() =>
     {
         await LibraryVM.UpdateBookByteSizeAll();
     });
     UpdateBookByteSizeStillNullCommand = new DelegateCommand(async() =>
     {
         await LibraryVM.UpdateBookByteSizeStillNull();
     });
     UpdateBookTagCommand = new DelegateCommand(async() =>
     {
         await LibraryVM.UpdateBookTag();
     });
     UpdateBookFingerPrintAllCommand = new DelegateCommand(async() =>
     {
         await LibraryVM.UpdateBookFingerPrintAll();
     });
     UpdateBookFingerPrintStillNullCommand = new DelegateCommand(async() =>
     {
         await LibraryVM.UpdateBookFingerPrintStillNull();
     });
 }