Пример #1
0
        /// <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;
        }
Пример #2
0
 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);
     }
 }
Пример #3
0
 private void UIElement_OnMouseRightButtonUp(object sender, MouseButtonEventArgs e)
 {
     RightClickCommand?.Execute(null);
 }
 async private void _control_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
 {
     await RightClickCommand.Execute();
 }