private void ValidateAndCorrectSciMagSettings() { if (SciMag == null) { SciMag = SciMagSettings.Default; } else { if (SciMag.DetailsWindow == null) { SciMag.DetailsWindow = SciMagDetailsWindowSettings.Default; } else { SciMagDetailsWindowSettings sciMagDetailsWindow = SciMag.DetailsWindow; if (sciMagDetailsWindow.Width < SCI_MAG_DETAILS_WINDOW_MIN_WIDTH) { sciMagDetailsWindow.Width = SCI_MAG_DETAILS_WINDOW_MIN_WIDTH; } if (sciMagDetailsWindow.Height < SCI_MAG_DETAILS_WINDOW_MIN_HEIGHT) { sciMagDetailsWindow.Height = SCI_MAG_DETAILS_WINDOW_MIN_HEIGHT; } } if (SciMag.Columns == null) { SciMag.Columns = SciMagColumnSettings.Default; } else { SciMagColumnSettings sciMagColumns = SciMag.Columns; if (sciMagColumns.TitleColumnWidth < SCI_MAG_GRID_TITLE_COLUMN_MIN_WIDTH) { sciMagColumns.TitleColumnWidth = SCI_MAG_GRID_TITLE_COLUMN_MIN_WIDTH; } if (sciMagColumns.AuthorsColumnWidth < SCI_MAG_GRID_AUTHORS_COLUMN_MIN_WIDTH) { sciMagColumns.AuthorsColumnWidth = SCI_MAG_GRID_AUTHORS_COLUMN_MIN_WIDTH; } if (sciMagColumns.JournalColumnWidth < SCI_MAG_GRID_JOURNAL_COLUMN_MIN_WIDTH) { sciMagColumns.JournalColumnWidth = SCI_MAG_GRID_JOURNAL_COLUMN_MIN_WIDTH; } if (sciMagColumns.YearColumnWidth < SCI_MAG_GRID_YEAR_COLUMN_MIN_WIDTH) { sciMagColumns.YearColumnWidth = SCI_MAG_GRID_YEAR_COLUMN_MIN_WIDTH; } if (sciMagColumns.FileSizeColumnWidth < SCI_MAG_GRID_FILESIZE_COLUMN_MIN_WIDTH) { sciMagColumns.FileSizeColumnWidth = SCI_MAG_GRID_FILESIZE_COLUMN_MIN_WIDTH; } if (sciMagColumns.DoiColumnWidth < SCI_MAG_GRID_DOI_COLUMN_MIN_WIDTH) { sciMagColumns.DoiColumnWidth = SCI_MAG_GRID_DOI_COLUMN_MIN_WIDTH; } } SciMag.ExportPanel = ValidateAndCorrectExportPanelSettings(SciMag.ExportPanel); } }
public SciMagSearchResultsTabViewModel(MainModel mainModel, IWindowContext parentWindowContext, string searchQuery, List <SciMagArticle> searchResults) : base(mainModel, parentWindowContext, LibgenObjectType.SCIMAG_ARTICLE, searchQuery) { columnSettings = mainModel.AppSettings.SciMag.Columns; LanguageFormatter formatter = MainModel.Localization.CurrentLanguage.Formatter; articles = new ObservableCollection <SciMagSearchResultItemViewModel>(searchResults.Select(article => new SciMagSearchResultItemViewModel(article, formatter))); Initialize(); }
public SciMagSearchResultsTabViewModel(MainModel mainModel, IWindowContext parentWindowContext, string searchQuery, ObservableCollection <SciMagArticle> searchResults) : base(mainModel, parentWindowContext, searchQuery) { columnSettings = mainModel.AppSettings.SciMag.Columns; this.searchQuery = searchQuery; articles = searchResults; ExportPanelViewModel = new ExportPanelViewModel(mainModel, LibgenObjectType.SCIMAG_ARTICLE, parentWindowContext); ExportPanelViewModel.ClosePanel += CloseExportPanel; OpenDetailsCommand = new Command(param => OpenDetails(param as SciMagArticle)); SearchCommand = new Command(Search); ArticleDataGridEnterKeyCommand = new Command(ArticleDataGridEnterKeyPressed); Initialize(); }
public SciMagSearchResultsTabViewModel(MainModel mainModel, IWindowContext parentWindowContext, string searchQuery, List <SciMagArticle> searchResults) : base(mainModel, parentWindowContext, LibgenObjectType.SCIMAG_ARTICLE, searchQuery) { columnSettings = mainModel.AppSettings.SciMag.Columns; LanguageFormatter formatter = MainModel.Localization.CurrentLanguage.Formatter; articles = new ObservableCollection <SciMagSearchResultItemViewModel>(searchResults.Select(article => new SciMagSearchResultItemViewModel(article, formatter))); ExportPanelViewModel.ClosePanel += CloseExportPanel; OpenDetailsCommand = new Command(param => OpenDetails((param as SciMagSearchResultItemViewModel)?.Article)); ExportCommand = new Command(ShowExportPanel); ArticleDataGridEnterKeyCommand = new Command(ArticleDataGridEnterKeyPressed); Initialize(); mainModel.Localization.LanguageChanged += LocalizationLanguageChanged; }