Ejemplo n.º 1
0
        public virtual void Remove()
        {
            DeleteFromDiagramMacroCommand c =
                (DeleteFromDiagramMacroCommand)DeleteFromDiagramMacroCommandFactory.Factory().Create(DiagramController);
            List <Element> list = new List <Element>();

            list.Add(Element);
            if (c.InitializeCommand(list))
            {
                c.Execute();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Removes selected elements from the active diagram.
        /// </summary>
        /// <seealso cref="IDeletable"/>
        /// <param name="parameter"></param>
        public override void Execute(object parameter)
        {
            DeleteFromDiagramMacroCommand c =
                (DeleteFromDiagramMacroCommand)DeleteFromDiagramMacroCommandFactory.Factory().Create(ActiveDiagramView.Controller);
            IEnumerable <IModelElementRepresentant> _deleted = ActiveDiagramView.SelectedRepresentants;
            List <Element> deleted = new List <Element>(_deleted.Count());

            foreach (IModelElementRepresentant deletable in _deleted)
            {
                deleted.Add(ActiveDiagramView.ElementRepresentations.GetElementRepresentedBy(deletable));
            }
            if (c.InitializeCommand(deleted))
            {
                c.Execute();
                ActiveDiagramView.SelectedItems.SetSelection();
            }
        }