protected SearchResultsTabViewModel(MainModel mainModel, IWindowContext parentWindowContext, LibgenObjectType libgenObjectType, string searchQuery) : base(mainModel, parentWindowContext, searchQuery) { this.libgenObjectType = libgenObjectType; emptySelectedItemFields = new ObservableCollection <string>(); this.searchQuery = searchQuery; lastExecutedSearchQuery = searchQuery; UpdateBookmarkedState(); isExportPanelVisible = false; isSearchProgressPanelVisible = false; isSearchResultsGridVisible = true; isStatusBarVisible = true; ExportPanelViewModel = new ExportPanelViewModel(mainModel, libgenObjectType, parentWindowContext); ExportPanelViewModel.ClosePanel += CloseExportPanel; SearchCommand = new Command(Search); InterruptSearchCommand = new Command(InterruptSearch); ToggleBookmarkCommand = new Command(ToggleBookmark); OpenDetailsCommand = new Command(OpenDetails); OpenFileCommand = new Command(OpenFile); DownloadCommand = new Command(Download); CopyCommand = new Command(param => Copy(param as string)); ToggleExportPanelCommand = new Command(ToggleExportPanel); mainModel.Localization.LanguageChanged += LocalizationLanguageChanged; Events.RaiseEvent(ViewModelEvent.RegisteredEventId.FOCUS_SEARCH_TEXT_BOX); }
public void ShowExportPanel() { if (IsSearchResultsGridVisible) { IsSearchResultsGridVisible = false; IsStatusBarVisible = false; IsExportPanelVisible = true; ExportPanelViewModel.ShowPanel(SearchQuery); } }
public override void ShowExportPanel() { if (IsBookGridVisible) { IsBookGridVisible = false; IsStatusBarVisible = false; IsExportPanelVisible = true; ExportPanelViewModel.ShowPanel(SearchQuery); } }
protected SearchResultsTabViewModel(MainModel mainModel, IWindowContext parentWindowContext, LibgenObjectType libgenObjectType, string searchQuery) : base(mainModel, parentWindowContext, searchQuery) { this.searchQuery = searchQuery; isExportPanelVisible = false; isSearchProgressPanelVisible = false; ExportPanelViewModel = new ExportPanelViewModel(mainModel, libgenObjectType, parentWindowContext); SearchCommand = new Command(Search); InterruptSearchCommand = new Command(InterruptSearch); }
private void LocalizationLanguageChanged(object sender, EventArgs e) { Language newLanguage = MainModel.Localization.CurrentLanguage; Localization = newLanguage.NonFictionSearchResultsTab; UpdateBookCount(); LanguageFormatter newFormatter = newLanguage.Formatter; foreach (NonFictionSearchResultItemViewModel book in Books) { book.UpdateLocalization(newFormatter); } ExportPanelViewModel.UpdateLocalization(newLanguage); }
protected SearchResultsTabViewModel(MainModel mainModel, IWindowContext parentWindowContext, LibgenObjectType libgenObjectType, string searchQuery) : base(mainModel, parentWindowContext, searchQuery) { this.libgenObjectType = libgenObjectType; this.searchQuery = searchQuery; lastExecutedSearchQuery = searchQuery; UpdateBookmarkedState(); isExportPanelVisible = false; isSearchProgressPanelVisible = false; ExportPanelViewModel = new ExportPanelViewModel(mainModel, libgenObjectType, parentWindowContext); SearchCommand = new Command(Search); InterruptSearchCommand = new Command(InterruptSearch); ToggleBookmarkCommand = new Command(ToggleBookmark); }
private void LocalizationLanguageChanged(object sender, EventArgs e) { Language newLanguage = MainModel.Localization.CurrentLanguage; Localization = newLanguage.SciMagSearchResultsTab; UpdateArticleCount(); LanguageFormatter newFormatter = newLanguage.Formatter; foreach (SciMagSearchResultItemViewModel article in Articles) { article.UpdateLocalization(newFormatter); } ExportPanelViewModel.UpdateLocalization(newLanguage); }
public void ToggleExportPanel() { if (IsSearchResultsGridVisible) { IsSearchResultsGridVisible = false; IsStatusBarVisible = false; IsExportPanelVisible = true; ExportPanelViewModel.ShowPanel(SearchQuery); } else if (!ExportPanelViewModel.IsExportInProgress) { IsExportPanelVisible = false; IsSearchResultsGridVisible = true; IsStatusBarVisible = true; } }
public SciMagSearchResultsTabViewModel(MainModel mainModel, IWindowContext parentWindowContext, string searchQuery, List <SciMagArticle> searchResults) : base(mainModel, parentWindowContext, searchQuery) { columnSettings = mainModel.AppSettings.SciMag.Columns; this.searchQuery = searchQuery; LanguageFormatter formatter = MainModel.Localization.CurrentLanguage.Formatter; articles = new ObservableCollection <SciMagSearchResultItemViewModel>(searchResults.Select(article => new SciMagSearchResultItemViewModel(article, formatter))); ExportPanelViewModel = new ExportPanelViewModel(mainModel, LibgenObjectType.SCIMAG_ARTICLE, parentWindowContext); ExportPanelViewModel.ClosePanel += CloseExportPanel; OpenDetailsCommand = new Command(param => OpenDetails((param as SciMagSearchResultItemViewModel)?.Article)); SearchCommand = new Command(Search); ExportCommand = new Command(ShowExportPanel); ArticleDataGridEnterKeyCommand = new Command(ArticleDataGridEnterKeyPressed); Initialize(); mainModel.Localization.LanguageChanged += LocalizationLanguageChanged; }
public NonFictionSearchResultsTabViewModel(MainModel mainModel, IWindowContext parentWindowContext, string searchQuery, List <NonFictionBook> searchResults) : base(mainModel, parentWindowContext, searchQuery) { columnSettings = mainModel.AppSettings.NonFiction.Columns; this.searchQuery = searchQuery; LanguageFormatter formatter = MainModel.Localization.CurrentLanguage.Formatter; books = new ObservableCollection <NonFictionSearchResultItemViewModel>(searchResults.Select(book => new NonFictionSearchResultItemViewModel(book, formatter))); ExportPanelViewModel = new ExportPanelViewModel(mainModel, LibgenObjectType.NON_FICTION_BOOK, parentWindowContext); ExportPanelViewModel.ClosePanel += CloseExportPanel; OpenDetailsCommand = new Command(param => OpenDetails((param as NonFictionSearchResultItemViewModel)?.Book)); SearchCommand = new Command(Search); ExportCommand = new Command(ShowExportPanel); BookDataGridEnterKeyCommand = new Command(BookDataGridEnterKeyPressed); Initialize(); mainModel.Localization.LanguageChanged += LocalizationLanguageChanged; }
protected virtual void UpdateLocalization(Language newLanguage) { ExportPanelViewModel.UpdateLocalization(newLanguage); }