public ColorEditorViewModel(IUserSettings userSettings) { OpenColorPickerCommand = new RelayCommand(() => OpenColorPickerRequested?.Invoke(this, EventArgs.Empty)); RemoveColorCommand = new RelayCommand(DeleteSelectedColor); SelectedColorChangedCommand = new RelayCommand((newColor) => { ColorsHistory.Insert(0, (Color)newColor); SelectedColorIndex = 0; }); ColorsHistory.CollectionChanged += ColorsHistory_CollectionChanged; _userSettings = userSettings; SetupAllColorRepresentations(); SetupAvailableColorRepresentations(); }
public ColorEditorViewModel(IUserSettings userSettings) { OpenColorPickerCommand = new RelayCommand(() => OpenColorPickerRequested?.Invoke(this, EventArgs.Empty)); OpenSettingsCommand = new RelayCommand(() => OpenSettingsRequested?.Invoke(this, EventArgs.Empty)); RemoveColorsCommand = new RelayCommand(DeleteSelectedColors); ExportColorsGroupedByColorCommand = new RelayCommand(ExportSelectedColorsByColor); ExportColorsGroupedByFormatCommand = new RelayCommand(ExportSelectedColorsByFormat); SelectedColorChangedCommand = new RelayCommand((newColor) => { if (ColorsHistory.Contains((Color)newColor)) { ColorsHistory.Remove((Color)newColor); } ColorsHistory.Insert(0, (Color)newColor); SelectedColorIndex = 0; }); ColorsHistory.CollectionChanged += ColorsHistory_CollectionChanged; _userSettings = userSettings; SetupAllColorRepresentations(); SetupAvailableColorRepresentations(); }