public LauncherViewModel(Engine engine, IResultsListViewModel resultsListViewModel) { _engine = engine; ResultsListViewModel = resultsListViewModel; QueryInputPreviewKeyDown = new RelayCommand(OnPreviewKeyDown); VisibilityChangedCommand = new RelayCommand(OnVisibilityChanged); }
public ThemeEditDialogViewModel(ThemesWindowViewModel themesWindowViewModel, Theme.Factory themeFactory) { _themesWindowViewModel = themesWindowViewModel; _themeFactory = themeFactory; SaveCommand = new RelayCommand(SaveExecute, SaveCanExecute); CancelCommand = new RelayCommand(CancelExecute); }
public ResultsListViewModel(Engine engine, ILogger logger) { _engine = engine; _logger = logger; PreviewKeyDown = new RelayCommand(OnPreviewKeyDown); Items.CollectionChanged += ItemsOnCollectionChanged; }
public ThemeEditorViewModel(ThemeManager themeManager, ThemeEditorLauncherViewModel launcherViewModel, IColorPickerWindow colorPickerWindow) { LauncherViewModel = launcherViewModel; _themeManager = themeManager; _colorPickerWindow = colorPickerWindow; _colorPickerWindow.ColorChanged += OnColorChanged; SaveCommand = new RelayCommand(param => Save()); RevertCommand = new RelayCommand(param => Revert()); UnloadedCommand = new RelayCommand(param => Unloaded()); }
/// <summary> /// Initializes a new instance of the <see cref="T:ThemesWindowViewModel" /> class. /// </summary> public ThemesWindowViewModel(ThemeEditorViewModel themeEditorViewModel, ThemeManager themeManager) { ThemeEditorViewModel = themeEditorViewModel; _themeManager = themeManager; Items = new ViewModelCollectionWrapper<ThemeViewModel, Theme>(_themeManager.Themes); // select the current theme if (themeManager.ActiveTheme != null) { SelectedItem = Items.First(t => t.Model == themeManager.ActiveTheme); } // connect the commands to methods DuplicateCommand = new RelayCommand(param => Duplicate()); ExportCommand = new RelayCommand(param => Export()); // delete command is only available if the ActiveTheme is editable DeleteCommand = new RelayCommand(param => Delete(), param => _themeManager.ActiveTheme != null && _themeManager.ActiveTheme.Editable); }
/// <summary> /// Initializes a new instance of the <see cref="T:ThemesWindowViewModel" /> class. /// </summary> public ThemesWindowViewModel(ThemeEditorViewModel themeEditorViewModel, ThemeManager themeManager, ThemeViewModel.Factory themeViewModelFactory, Func<ThemesWindowViewModel, ThemeEditDialogViewModel> themeEditDialogViewModelFactory, IDialogService dialogService) { ThemeEditorViewModel = themeEditorViewModel; ThemeManager = themeManager; EditDialogViewModel = themeEditDialogViewModelFactory(this); _dialogService = dialogService; Items = new ViewModelCollectionWrapper<ThemeViewModel, Theme>(ThemeManager.Themes, model => themeViewModelFactory(model, this)); OnLoadedCommand = () => { // select the current theme if (themeManager.ActiveTheme != null) { SelectItemByModel(themeManager.ActiveTheme); } }; CreateThemeCommand = new RelayCommand(o => ShowEditDialog()); }