/// <summary> /// Конструктор MainWindowVM /// </summary> public MainWindowVM() { RectangulationCommand = new RectangulationCommand(); ClearCommand = new ClearCommand(); LeftClickCommand = new LeftClickCommand(); RightClickCommand = new RightClickCommand(); Shapes = new CompositeCollection(); Polygons = new ObservableCollection <PolygonVM>(); Rectangles = new ObservableCollection <RectangleVM>(); var polygonContainer = new CollectionContainer { Collection = Polygons }; Shapes.Add(polygonContainer); var rectangleContainer = new CollectionContainer { Collection = Rectangles }; Shapes.Add(rectangleContainer); CurrentPolygon = null; RectWidth = 20; RectHeight = 20; SelectedRectangleVM = null; }
void _icon_MouseClick(object sender, System.Windows.Input.MouseButtonEventArgs e) { if (e.ChangedButton == MouseButton.Left && LeftClickCommand != null && LeftClickCommand.CanExecute(sender)) { LeftClickCommand.Execute(sender); } else if (e.ChangedButton == MouseButton.Right && RightClickCommand != null && RightClickCommand.CanExecute(sender)) { RightClickCommand.Execute(sender); } }
private void UIElement_OnMouseRightButtonUp(object sender, MouseButtonEventArgs e) { RightClickCommand?.Execute(null); }
async private void _control_MouseRightButtonDown(object sender, MouseButtonEventArgs e) { await RightClickCommand.Execute(); }