Exemplo n.º 1
0
        public void NewContentTab(IEnumerable <BookViewModel> list)
        {
            var newTabViewModel = (App.Current.Resources["Ioc"] as IUnityContainer).Resolve <IDocumentViewModelBase>("ContentDocumentViewModel");

            newTabViewModel.Title                  = "Filtered";
            newTabViewModel.BookCabinet            = LibraryVM.CreateBookStorage();
            newTabViewModel.BookCabinet.BookSource = new ObservableCollection <BookViewModel>();
            newTabViewModel.BookCabinet.BookSource.AddRange(list);
            newTabViewModel.BookCabinet.Sorting     = (App.Current.MainWindow.DataContext as MainWindowViewModel).ActiveDocumentViewModel.BookCabinet.Sorting;
            newTabViewModel.BookCabinet.DisplayType = (App.Current.MainWindow.DataContext as MainWindowViewModel).ActiveDocumentViewModel.BookCabinet.DisplayType;
            DockingDocumentViewModels.Add(newTabViewModel);

            (LibraryVM as IObservable <BookCollectionChanged>)
            .Subscribe(newTabViewModel.BookCabinet as IObserver <BookCollectionChanged>)
            .AddTo(_disposable);

            newTabViewModel.IsVisible = true;
        }
Exemplo n.º 2
0
        public void NewSearchTab(ObservableCollection <BookViewModel> onStage)
        {
            var newTabViewModel = (App.Current.Resources["Ioc"] as IUnityContainer).Resolve <IDocumentViewModelBase>("SearchDocumentViewModel");

            newTabViewModel.Title                   = "Search results";
            newTabViewModel.BookCabinet             = LibraryVM.CreateBookStorage();
            newTabViewModel.BookCabinet.BookSource  = new ObservableCollection <BookViewModel>(onStage);
            newTabViewModel.BookCabinet.Sorting     = (App.Current.MainWindow.DataContext as MainWindowViewModel).ActiveDocumentViewModel.BookCabinet.Sorting;
            newTabViewModel.BookCabinet.DisplayType = (App.Current.MainWindow.DataContext as MainWindowViewModel).ActiveDocumentViewModel.BookCabinet.DisplayType;
            DockingDocumentViewModels.Add(newTabViewModel);

            (LibraryVM as IObservable <BookCollectionChanged>)
            .Subscribe(newTabViewModel.BookCabinet as IObserver <BookCollectionChanged>)
            .AddTo(_disposable);

            newTabViewModel.IsVisible  = true;
            newTabViewModel.IsSelected = true;
            ActiveDocumentViewModel    = newTabViewModel;
        }