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); }