public SettingsModuleViewModel(IStateManager state_manager, IThemeController theme_controller, ApplicationNavigationPartViewModel application_navigation_part, ToolsNavigationPartViewModel tools_navigation_part) { this.state_manager = state_manager; this.theme_controller = theme_controller; ApplicationNavigationPart = application_navigation_part; ToolsNavigationPart = tools_navigation_part; this.WhenAnyValue(x => x.SelectedPrimaryColor) .Where(swatch => swatch != null) .Select(swatch => swatch.Name) .Subscribe(swatch_name => { state_manager.Settings.PrimaryColorName = swatch_name; theme_controller.SetPrimary(swatch_name); }); this.WhenAnyValue(x => x.SelectedAccentColor) .Where(swatch => swatch != null) .Select(swatch => swatch.Name) .Subscribe(swatch_name => { state_manager.Settings.AccentColorName = swatch_name; theme_controller.SetAccent(swatch_name); }); this.WhenAnyValue(x => x.IsThemeDark) .Subscribe(x => { state_manager.Settings.IsDarkTheme = IsThemeDark; theme_controller.SetBase(IsThemeDark); }); }
public LogsModuleViewModel(ApplicationNavigationPartViewModel application_navigation_part, ToolsNavigationPartViewModel tools_navigation_part) { ApplicationNavigationPart = application_navigation_part; ToolsNavigationPart = tools_navigation_part; log_target = LogManager.Configuration.AllTargets.OfType <MemoryTarget>().FirstOrDefault(); }
public SeriesModuleViewModel(ApplicationNavigationPartViewModel application_navigation_part, CollectionsNavigationPartViewModel collections_navigation_part, ToolsNavigationPartViewModel tools_navigation_part, CollectionInformationPartViewModel collection_information_part, IStateManager state_manager) : base(application_navigation_part, collections_navigation_part, tools_navigation_part, collection_information_part) { this.state_manager = state_manager; }
public NotesModuleViewModel(ApplicationNavigationPartViewModel application_navigation_part, CollectionsNavigationPartViewModel collections_navigation_part, ToolsNavigationPartViewModel tools_navigation_part, CollectionInformationPartViewModel collection_information_part, NotesViewModel notes_view_model) : base(application_navigation_part, collections_navigation_part, tools_navigation_part, collection_information_part) { NotesList = notes_view_model; var have_selected_note = this.WhenAnyValue(x => x.NotesList.SelectedNote) .Select(x => x != null); _CanEdit = have_selected_note.ToProperty(this, x => x.CanEdit); }
public ToolsModuleViewModel(ApplicationNavigationPartViewModel application_navigation_part, ToolsNavigationPartViewModel tools_navigation_part, IBackgroundProcessor background_processor) { ApplicationNavigationPart = application_navigation_part; ToolsNavigationPart = tools_navigation_part; this.background_processor = background_processor; this.WhenAnyValue(x => x.background_processor.Status) .Where(s => s != null) .Select(s => s.FirstOrDefault(p => p.Type == typeof(BookInformationItem))) .Subscribe(p => BookInformationCount = (p == null ? 0 : p.Count)); this.WhenAnyValue(x => x.background_processor.Status) .Where(s => s != null) .Select(s => s.FirstOrDefault(p => p.Type == typeof(SeriesInformationItem))) .Subscribe(p => SeriesInformationCount = (p == null ? 0 : p.Count)); this.WhenAnyValue(x => x.background_processor.Status) .Where(s => s != null) .Select(s => s.FirstOrDefault(p => p.Type == typeof(SeriesEntryInformationItem))) .Subscribe(p => EntriesInformationCount = (p == null ? 0 : p.Count)); }
public ImportModuleViewModel(IStateManager state_manager, IImportController import_controller, ApplicationNavigationPartViewModel application_navigation_part, ToolsNavigationPartViewModel tools_navigation_part) { this.state_manager = state_manager; this.import_controller = import_controller; ApplicationNavigationPart = application_navigation_part; ToolsNavigationPart = tools_navigation_part; this.WhenAnyValue(x => x.FullFilename) .Subscribe(x => Filename = Path.GetFileName(x)); OpenFileCommand = ReactiveCommand.Create(OpenFile); var have_imported_books = this.WhenAny(x => x.Books, x => x.Value != null && x.Value.Any()); ImportBooksCommand = ReactiveCommand.Create(ImportBooks, have_imported_books); var have_shelves = this.WhenAny(x => x.Shelves, x => x.Value != null && x.Value.Any()); SelectAllShelvesCommand = ReactiveCommand.Create(() => Shelves.Apply(s => s.Selected = true), have_shelves); DeselectAllShelvesCommand = ReactiveCommand.Create(() => Shelves.Apply(s => s.Selected = false), have_shelves); }
public BooksModuleViewModel(ApplicationNavigationPartViewModel application_navigation_part, CollectionsNavigationPartViewModel collections_navigation_part, ToolsNavigationPartViewModel tools_navigation_part, CollectionInformationPartViewModel collection_information_part, IStateManager state_manager, ISearchEngine <Book> search_engine, SearchFieldViewModel search_field, BookDetailsViewModel book_details, ShelvesViewModel shelves_list) : base(application_navigation_part, collections_navigation_part, tools_navigation_part, collection_information_part) { this.state_manager = state_manager; this.search_engine = search_engine; SearchField = search_field; BookDetails = book_details; ShelvesList = shelves_list; this.WhenAnyValue(x => x.SearchField.Text) .Throttle(TimeSpan.FromMilliseconds(250), RxApp.MainThreadScheduler) .Subscribe(Search); (this).WhenAnyObservable(x => x.ShelvesList.Shelves.SomethingChanged) .Subscribe(_ => UpdateSelectedShelves()); }