Beispiel #1
0
        private void FictionDetailsWindowClosed(object sender, EventArgs e)
        {
            FictionDetailsWindowViewModel fictionDetailsWindowViewModel = sender as FictionDetailsWindowViewModel;

            fictionDetailsWindowViewModel.SelectDownloadRequested -= SelectDownloadRequested;
            fictionDetailsWindowViewModel.WindowClosed            -= NonFictionDetailsWindowClosed;
        }
Beispiel #2
0
 private void OpenFictionDetailsRequested(object sender, OpenFictionDetailsEventArgs e)
 {
     Logger.Debug($"Opening fiction book with ID = {e.FictionBook.Id}, Libgen ID = {e.FictionBook.LibgenId}.");
     SearchSettings.DetailsMode openDetailsMode = MainModel.AppSettings.Search.OpenDetailsMode;
     if (openDetailsMode == SearchSettings.DetailsMode.NEW_TAB)
     {
         FictionDetailsTabViewModel fictionDetailsTabViewModel
             = new FictionDetailsTabViewModel(MainModel, CurrentWindowContext, e.FictionBook, isInModalWindow: false);
         fictionDetailsTabViewModel.SelectDownloadRequested += SelectDownloadRequested;
         fictionDetailsTabViewModel.CloseTabRequested       += FictionDetailsCloseTabRequested;
         TabViewModels.Add(fictionDetailsTabViewModel);
         SelectedTabViewModel = fictionDetailsTabViewModel;
     }
     else
     {
         bool modalWindow = openDetailsMode == SearchSettings.DetailsMode.NEW_MODAL_WINDOW;
         FictionDetailsWindowViewModel detailsWindowViewModel = new FictionDetailsWindowViewModel(MainModel, e.FictionBook, modalWindow);
         detailsWindowViewModel.SelectDownloadRequested += SelectDownloadRequested;
         IWindowContext detailsWindowContext = WindowManager.CreateWindow(RegisteredWindows.WindowKey.FICTION_DETAILS_WINDOW, detailsWindowViewModel, CurrentWindowContext);
         FictionDetailsWindowSettings detailsWindowSettings = MainModel.AppSettings.Fiction.DetailsWindow;
         if (modalWindow)
         {
             detailsWindowContext.ShowDialog(detailsWindowSettings.Width, detailsWindowSettings.Height);
             detailsWindowViewModel.SelectDownloadRequested -= SelectDownloadRequested;
         }
         else
         {
             detailsWindowViewModel.WindowClosed += FictionDetailsWindowClosed;
             detailsWindowContext.Show(detailsWindowSettings.Width, detailsWindowSettings.Height);
         }
     }
 }