Example #1
0
 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());
 }
Example #2
0
        /// <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);
        }
Example #3
0
        /// <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());
        }