private void PaletteColorSelectedMessageReceived(PaletteColorSelectedMessage message) { if (SelectedColor != null && SelectedColor.Id != message.Id) { SelectedColor.Unselect(); } SelectedColor = PaletteColors.First(x => x.Id == message.Id); }
public PaletteViewModel(IViewModelServices viewModelServices) : base(viewModelServices) { Subscribe <PaletteColorSelectedMessage> (PaletteColorSelectedMessageReceived); var textures = new List <Texture> { new Texture { Color = Color.Black }, new Texture { Color = Color.Red }, new Texture { Color = Color.Blue }, new Texture { Path = "BlackPenTexture.png" }, new Texture { Path = "RedPenTexture.png" }, new Texture { Path = "BluePenTexture.png" }, new Texture { Path = "PencilTexture.png" }, new Texture { Color = Color.White } }; var list = new List <PaletteColorViewModel> (); var i = 0; foreach (var texture in textures) { var vm = new PaletteColorViewModel(viewModelServices, texture, i); list.Add(vm); i++; } PaletteColors = new List <PaletteColorViewModel> (list); MaxThickness = 10; MinThickness = 1; PointThickness = 2; }
public void SetSelectedColor(Texture texture) { SelectedColor?.Unselect(); SelectedColor = PaletteColors.First(x => x.Texture == texture); SelectedColor.Select(); }