private void DrawingArea_MouseDown(object sender, MouseButtonEventArgs e)
 {
     //if (currentlyPressed == deadMouse)
     //{
     startingPoint = e.GetPosition(DrawingArea);
     if (currentState == drawingState.PanView)
     {
         MoveOnHitRectangle();
     }
     else if (e.RightButton == MouseButtonState.Pressed && currentState != drawingState.PanView)
     {
         // We have to Hit detect, if it is a rectangle we can now move
         currentState = drawingState.RightClickOnCreateBounds;
         MoveOnHitRectangle();
     }
     else if (currentState == drawingState.CreateNewBounds)
     {
         // Creating and tracking a new Rectangle
         toCreateRectangle = new System.Windows.Shapes.Rectangle();
         toCreateRectangle.Stroke = Brushes.Black;
         toCreateRectangle.Opacity = .65;
         toCreateRectangle.Fill = Brushes.RoyalBlue;
         toCreateRectangle.StrokeThickness = 4;
         toCreateRectangle.MinWidth = 25;
         toCreateRectangle.MinHeight = 25;
         Canvas.SetLeft(toCreateRectangle, startingPoint.X);
         Canvas.SetTop(toCreateRectangle, startingPoint.Y);
         DrawingArea.Children.Add(toCreateRectangle);
     }
     //}
 }
 public void OnDrawingChangeInvoker(drawingState e)
 {
     EventHandler<DrawingStateEventArgs> safetyNetHandler = DrawingStateChange;
     if (safetyNetHandler != null)
     {
         safetyNetHandler(this, new DrawingStateEventArgs(e));
     }
 }
        private void DrawingArea_MouseDown(object sender, MouseButtonEventArgs e)
        {
            if (IsCurrentState(drawingState.CreateNewBounds) && e.RightButton == MouseButtonState.Pressed && NotCurrentState(drawingState.PanView))
            {
                currentState = drawingState.RightClickOnCreateBounds;
                _DrawingStateHandler.OnDrawingChangeInvoker(currentState);
            }
            else
                if (IsCurrentState(drawingState.CreateNewBounds))
                {
                    startingPoint = e.GetPosition(DrawingArea);
                    // Creating and tracking a new Zone
                    currentZone = new ResizeZone();
                    currentZone.Opacity = .65;
                    Canvas.SetLeft(currentZone, startingPoint.X);
                    Canvas.SetTop(currentZone, startingPoint.Y);

                    DrawingArea.Children.Add(currentZone);
                    currentZone.number = DrawingArea.Children.Count;
                    subToInvoker(currentZone);
                }
        }
Ejemplo n.º 4
0
 private void Pan_And_Selection_View_Click(object sender, RoutedEventArgs e)
 {
     if (e.Source == RectangleCreator)
     {
         DrawingArea.Background = Brushes.Blue;
         currentState = drawingState.CreateNewBounds;
     }
     else if (e.Source == PanView)
     {
         DrawingArea.Background = Brushes.Cyan;
         currentState = drawingState.PanView;
     }
 }
Ejemplo n.º 5
0
 private bool IsCurrentState(drawingState variable)
 {
     return currentState == variable;
 }
 public DrawingStateEventArgs(drawingState x)
 {
     this.passedInState = x;
 }
        private void Pan_And_Selection_View_Click(object sender, RoutedEventArgs e)
        {
            if (e.Source == RectangleCreator)
            {
                DrawingArea.Background = (Brush) this.FindResource("DrawingAreaColor");
                currentState = drawingState.CreateNewBounds;
            }
            else if (e.Source == PanView)
            {
                DrawingArea.Background = (Brush)this.FindResource("DrawingAreaPanView");

                currentState = drawingState.PanView;
            }
            _DrawingStateHandler.OnDrawingChangeInvoker(currentState);
        }
 private bool NotCurrentState(drawingState variable)
 {
     return !IsCurrentState(variable);
 }
        private void DrawingArea_MouseUp(object sender, MouseButtonEventArgs e)
        {
            if (IsCurrentState(drawingState.CreateNewBounds))
            {
                if (currentZone != null)
                {
                    currentZone.IsEnabled = true;
                    _DrawingStateHandler.DrawingStateChange += currentZone.AdjustingDrawingState;
                }
            }

            if (IsCurrentState(drawingState.RightClickOnCreateBounds))
            {
                currentState = drawingState.CreateNewBounds;
                _DrawingStateHandler.OnDrawingChangeInvoker(currentState);
            }

            currentZone = null;
            startingPoint = new Point();
        }
 private void DrawingArea_MouseUp(object sender, MouseButtonEventArgs e)
 {
     if (IsCurrentState(drawingState.RightClickOnCreateBounds))
     {
         currentState = drawingState.CreateNewBounds;
     }
     toCreateRectangle = null;
     startingPoint = new Point();
 }