public static void AddChangeColorCommand(this UICommandCollection menu, string text, Color defaultSelectedColor, Color automaticColor, Action <object, Color> handler) { var cmd = new UICommand("", text, CommandType.ColorPickerCommand); var colorPicker = new UIColorPicker(); colorPicker.Configure(); colorPicker.SelectedColor = defaultSelectedColor; colorPicker.AutomaticColor = automaticColor; colorPicker.SelectedColorChanged += (sender, e) => { Color selectedColor = ((UIColorPicker)sender).SelectedColor; cmd.Image = DrawContextIcon(selectedColor); handler(sender, selectedColor); }; colorPicker.AutomaticButtonClick += (sender, e) => { cmd.Image = DrawContextIcon(automaticColor); handler(sender, automaticColor); }; cmd.Control = colorPicker; cmd.Image = DrawContextIcon(defaultSelectedColor); menu.Add(cmd); }
public static void AddSeparator(this UICommandCollection commands) { var sep = new UICommand("", string.Empty, CommandType.Separator); commands.Add(sep); }