public MainWindowViewModel(MainModel mainModel) : base(mainModel) { defaultSearchTabViewModel = null; Events = new EventProvider(); NewTabCommand = new Command(NewTab); CloseTabCommand = new Command(param => CloseTab(param as TabViewModel)); CloseCurrentTabCommand = new Command(CloseCurrentTab); ExportCommand = new Command(Export); DownloadManagerCommand = new Command(ShowDownloadManager); ShowApplicationUpdateCommand = new Command(ShowApplicationUpdate); ImportCommand = new Command(Import); SynchronizeCommand = new Command(Synchronize); LibraryCommand = new Command(LibraryMenuItemClick); DatabaseCommand = new Command(DatabaseMenuItemClick); BookmarkCommand = new Command(param => BookmarksMenuItemClick(param as BookmarkViewModel)); SettingsCommand = new Command(SettingsMenuItemClick); AboutCommand = new Command(AboutMenuItemClick); WindowClosedCommand = new Command(WindowClosed); TabViewModels = new ObservableCollection <TabViewModel>(); Initialize(); mainModel.ApplicationUpdateCheckCompleted += ApplicationUpdateCheckCompleted; mainModel.BookmarksChanged += BookmarksChanged; mainModel.Localization.LanguageChanged += LocalizationLanguageChanged; mainModel.Downloader.DownloaderEvent += DownloaderEvent; }
private void NewTab() { if (IsNewTabButtonVisible) { SearchTabViewModel searchTabViewModel = new SearchTabViewModel(MainModel, CurrentWindowContext); searchTabViewModel.NonFictionSearchComplete += SearchTabNonFictionSearchComplete; searchTabViewModel.FictionSearchComplete += SearchTabFictionSearchComplete; searchTabViewModel.SciMagSearchComplete += SearchTabSciMagSearchComplete; TabViewModels.Add(searchTabViewModel); SelectedTabViewModel = searchTabViewModel; NotifyPropertyChanged(nameof(IsNewTabButtonVisible)); } }
private void ShowSearchResults(SearchTabViewModel searchTabViewModel, TabViewModel searchResultsTabViewModel) { if (searchTabViewModel != DefaultSearchTabViewModel) { searchTabViewModel.NonFictionSearchComplete -= SearchTabNonFictionSearchComplete; searchTabViewModel.FictionSearchComplete -= SearchTabFictionSearchComplete; searchTabViewModel.SciMagSearchComplete -= SearchTabSciMagSearchComplete; TabViewModels.Remove(searchTabViewModel); } TabViewModels.Add(searchResultsTabViewModel); SelectedTabViewModel = searchResultsTabViewModel; NotifyPropertyChanged(nameof(IsDefaultSearchTabVisible)); NotifyPropertyChanged(nameof(AreTabsVisible)); NotifyPropertyChanged(nameof(IsNewTabButtonVisible)); }
/// <summary> /// Initializes a new instance of the <see cref="SearchTabView" /> class. /// </summary> /// <param name="vm"> /// The vm. /// </param> public SearchTabView(SearchTabViewModel vm) { InitializeComponent(); DataContext = vm; }
public SearchTab(SearchTabViewModel viewModel) { InitializeComponent(); this.DataContext = viewModel; }
public SearchTab() { InitializeComponent(); BindingContext = new SearchTabViewModel(Navigation); }