/// <summary>
 /// Draws an providen component to the canvas
 /// </summary>
 /// <param name="components"></param>
 private void DrawComponents(List <WorkflowComponent> components)
 {
     if (components.Count > 0)
     {
         CorrectLeftAndTop(components);
         editorCanvas.Height = components.Max(component => component.Y) + 60;
         editorCanvas.Width  = components.Max(component => component.X) + 100;
     }
     foreach (var component in components)
     {
         var item = new WorkflowComponentUserControl(component);
         item.MouseLeftButtonDown += StartDragging;
         item.MouseLeftButtonUp   += FinishMoving;
         item.OnUpdate            += Item_OnUpdate;
         editorCanvas.Children.Add(item);
     }
 }
 /// <summary>
 /// Handels all necessary steps to start dragging
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void StartDragging(object sender, MouseButtonEventArgs e)
 {
     MouseHelper.TrapMouseInsideControl(editorBorder);
     _selectedComponent = (WorkflowComponentUserControl)sender;
     if (e.OriginalSource is Ellipse)
     {
         var component = _selectedComponent.Component;
         _customPath = new CustomPath(component, new Point(component.X + 95, component.Y + ComponentHeight / 2 - ComponentPadding));
         editorCanvas.Children.Add(_customPath.Path);
         MouseMove += MovePath;
         WorkflowComponentUserControls.ForEach(comp => comp.NewSource(_selectedComponent.Component));
     }
     else
     {
         _startPoint = e.GetPosition(_selectedComponent);
         MouseMove  += MoveComponent;
     }
 }
 /// <summary>
 /// Finishes the drag and drop action
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void FinishMoving(object sender, MouseButtonEventArgs e)
 {
     MouseHelper.ClearMouseTrap();
     if (_selectedComponent != null)
     {
         _startPoint        = new Point();
         MouseMove         -= MoveComponent;
         _selectedComponent = null;
     }
     if (_customPath != null)
     {
         MouseMove -= MovePath;
         editorCanvas.Children.Remove(_customPath.Path);
         if (CurrentHoveredComponent != null)
         {
             AddConnection(_customPath.Source, (CurrentHoveredComponent as WorkflowComponentUserControl).Component);
         }
         _customPath = null;
         DrawCanvas(this, null);
     }
 }