コード例 #1
0
 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;
 }
コード例 #2
0
 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));
     }
 }
コード例 #3
0
 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));
 }
コード例 #4
0
 /// <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;
 }
コード例 #5
0
 public SearchTab(SearchTabViewModel viewModel)
 {
     InitializeComponent();
     this.DataContext = viewModel;
 }
コード例 #6
0
 public SearchTab()
 {
     InitializeComponent();
     BindingContext = new SearchTabViewModel(Navigation);
 }
コード例 #7
0
 /// <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;
 }