Пример #1
0
 /// <summary>
 /// Deselect the specified element
 /// </summary>
 /// <param name="container"></param>
 public void DeselectElement(IDrawableContainer container)
 {
     container.HideGrippers();
     container.Selected = false;
     selectedElements.Remove(container);
     FieldAggregator.UnbindElement(container);
     if (_movingElementChanged != null)
     {
         SurfaceElementEventArgs eventArgs = new SurfaceElementEventArgs();
         eventArgs.Elements = selectedElements;
         _movingElementChanged(this, eventArgs);
     }
 }
Пример #2
0
 /// <summary>
 /// Select the supplied element
 /// </summary>
 /// <param name="container"></param>
 public void SelectElement(IDrawableContainer container)
 {
     if (!selectedElements.Contains(container))
     {
         selectedElements.Add(container);
         container.ShowGrippers();
         container.Selected = true;
         FieldAggregator.BindElement(container);
         if (_movingElementChanged != null)
         {
             SurfaceElementEventArgs eventArgs = new SurfaceElementEventArgs();
             eventArgs.Elements = selectedElements;
             _movingElementChanged(this, eventArgs);
         }
         container.Invalidate();
     }
 }
Пример #3
0
 /// <summary>
 /// Deselect all the selected elements
 /// </summary>
 public void DeselectAllElements()
 {
     if (HasSelectedElements)
     {
         while (selectedElements.Count > 0)
         {
             IDrawableContainer element = selectedElements[0];
             element.Invalidate();
             element.HideGrippers();
             element.Selected = false;
             selectedElements.Remove(element);
             FieldAggregator.UnbindElement(element);
         }
         if (_movingElementChanged != null)
         {
             SurfaceElementEventArgs eventArgs = new SurfaceElementEventArgs();
             eventArgs.Elements = selectedElements;
             _movingElementChanged(this, eventArgs);
         }
     }
 }
Пример #4
0
 /// <summary>
 /// Remove all the selected elements
 /// </summary>
 public void RemoveSelectedElements()
 {
     if (HasSelectedElements)
     {
         // As RemoveElement will remove the element from the selectedElements list we need to copy the element
         // to another list.
         List<DrawableContainer> elementsToRemove = new List<DrawableContainer>();
         foreach (DrawableContainer element in selectedElements)
         {
             // Collect to remove later
             elementsToRemove.Add(element);
         }
         // Remove now
         foreach (DrawableContainer element in elementsToRemove)
         {
             RemoveElement(element, true);
         }
         selectedElements.Clear();
         if (_movingElementChanged != null)
         {
             SurfaceElementEventArgs eventArgs = new SurfaceElementEventArgs();
             eventArgs.Elements = selectedElements;
             _movingElementChanged(this, eventArgs);
         }
     }
 }