public void InvokeDrawingZone(DrawingZone abs, DrawingMattStates currentState)
 {
     var safteyNet = DrawingStateChange;
     if (safteyNet != null)
     {
         safteyNet(abs, new DrawingZoneEventArgs(currentState));
     }
 }
        private void Canvas_MouseDown(object sender, MouseButtonEventArgs e)
        {
            MouseLocation = e.GetPosition(CanvasArea);//Left corner of mouse
            // Have members created so that when the mouse is over them that the master control locks down
            if (e.LeftButton == MouseButtonState.Pressed && CurrentState.Equals(DrawingMattStates.PendingCreation))
            {
                CurrentState = DrawingMattStates.DrawZoneCreation;

                var drawingArea = new DrawingZone();

                Canvas.SetLeft(drawingArea, MouseLocation.X);
                Canvas.SetTop(drawingArea, MouseLocation.Y);

                CanvasArea.Children.Add(drawingArea);
                drawingArea.ZoneNumber = CanvasArea.Children.Count;
                SubToDrawingZoneInvoker(drawingArea);

                // Need to select it
                Selected = drawingArea;
            }
        }
 /// <summary>
 /// This method is invoked when a drawing area comes in contact with the mouse
 /// </summary>
 void OnDrawingStateChange(object sender, JF_CustomEventHandlers.DrawingRectangles.DrawingZoneEventArgs e)
 {
     if (sender is DrawingZone)
     {
         if (CurrentState != DrawingMattStates.DrawZoneCreation)
         {
             CurrentState = e.CurrentStateChange;
             if (CurrentState.Equals(DrawingMattStates.DrawZonePanning))
             {
                 Selected.IsSelected = false;
                 Selected = sender as DrawingZone;
                 Selected.IsSelected = true;
             }
         }
     }
 }