private void OpenSciMagDetailsRequested(object sender, SciMagSearchResultsTabViewModel.OpenSciMagDetailsEventArgs e) { Logger.Debug($"Opening article with ID = {e.SciMagArticle.Id}, Libgen ID = {e.SciMagArticle.LibgenId}."); SearchSettings.DetailsMode openDetailsMode = mainModel.AppSettings.Search.OpenDetailsMode; if (openDetailsMode == SearchSettings.DetailsMode.NEW_TAB) { SciMagDetailsTabViewModel sciMagDetailsTabViewModel = new SciMagDetailsTabViewModel(mainModel, CurrentWindowContext, e.SciMagArticle, isInModalWindow: false); sciMagDetailsTabViewModel.CloseTabRequested += SciMagDetailsCloseTabRequested; TabViewModels.Add(sciMagDetailsTabViewModel); SelectedTabViewModel = sciMagDetailsTabViewModel; } else { bool modalWindow = openDetailsMode == SearchSettings.DetailsMode.NEW_MODAL_WINDOW; SciMagDetailsWindowViewModel detailsWindowViewModel = new SciMagDetailsWindowViewModel(mainModel, e.SciMagArticle, modalWindow); IWindowContext detailsWindowContext = WindowManager.CreateWindow(RegisteredWindows.WindowKey.SCI_MAG_DETAILS_WINDOW, detailsWindowViewModel, CurrentWindowContext); SciMagDetailsWindowSettings detailsWindowSettings = mainModel.AppSettings.SciMag.DetailsWindow; if (modalWindow) { detailsWindowContext.ShowDialog(detailsWindowSettings.Width, detailsWindowSettings.Height); } else { detailsWindowContext.Show(detailsWindowSettings.Width, detailsWindowSettings.Height); } } }
public SciMagDetailsWindowViewModel(MainModel mainModel, SciMagArticle article, bool modalWindow) { this.mainModel = mainModel; this.article = article; this.modalWindow = modalWindow; tabViewModel = null; WindowTitle = article.Title; WindowWidth = mainModel.AppSettings.SciMag.DetailsWindow.Width; WindowHeight = mainModel.AppSettings.SciMag.DetailsWindow.Height; WindowClosedCommand = new Command(WindowClosed); }