public MainWindow() { InitializeComponent(); SimplePaintViewModel f = DataContext as SimplePaintViewModel; for (int i = 0; i < 20; i++) { Button newBtn = new Button { Name = "b" + i.ToString(), Background = new SolidColorBrush(Color.FromRgb(f.Colors[i].Color.R, f.Colors[i].Color.G, f.Colors[i].Color.B)), }; if (i > 9) { Grid.SetRow(newBtn, 1); Grid.SetColumn(newBtn, i - 10); } else { Grid.SetRow(newBtn, 0); Grid.SetColumn(newBtn, i); } newBtn.Command = f.Cbc; newBtn.CommandParameter = i; ColorPanel.Children.Add(newBtn); } KeyGesture undo = new KeyGesture(Key.Z, ModifierKeys.Control); KeyBinding undoBinding = new KeyBinding(f.Buc, undo); this.InputBindings.Add(undoBinding); }
public OpenFileCommand(SimplePaintViewModel simplePaintViewModel) { _simplePaintViewModel = simplePaintViewModel; }
public ButtonUndoCommand(SimplePaintViewModel simplePaintViewModel) { _simplePaintViewModel = simplePaintViewModel; }
public ClearCommand(SimplePaintViewModel simplePaintViewModel) { _simplePaintViewModel = simplePaintViewModel; }
public ChangeButtonColor(SimplePaintViewModel simplePaintViewModel) { _simplePaintViewModel = simplePaintViewModel; }
public void Execute(object parameter) { SimplePaintViewModel.CreateNewImage(_newPageInputViewModel.Width, _newPageInputViewModel.Height); Application.Current.Windows[1]?.Close(); }
public OpenSaveWindowCommand(SimplePaintViewModel simplePaintViewModel) { _simplePaintViewModel = simplePaintViewModel; }
public MouseCommandSave(SimplePaintViewModel simplePaintViewModel) { _simplePaintViewModel = simplePaintViewModel; }
public ImageCommand(SimplePaintViewModel simplePaintViewModel) { _simplePaintViewModel = simplePaintViewModel; }
public StretchCommand(SimplePaintViewModel simplePaintViewModel) { _simplePaintViewModel = simplePaintViewModel; }