示例#1
0
        private void OnClassRemoveClick(object sender, RoutedEventArgs e)
        {
            DeleteFromModelMacroCommand c = (DeleteFromModelMacroCommand)DeleteFromModelMacroCommandFactory.Factory().Create(project.GetModelController());

            c.Set(((MenuItem)sender).DataContext as PIMClass, ActiveDiagram != null ? ActiveDiagram.Controller : null);
            if (c.Commands.Count > 0)
            {
                c.Execute();
            }
        }
示例#2
0
        /// <summary>
        /// Removes selected elements from the model
        /// </summary>
        /// <seealso cref="IDeletable"/>
        /// <param name="parameter"></param>
        public override void Execute(object parameter)
        {
            IEnumerable <IModelElementRepresentant> _deleted = ActiveDiagramView.SelectedRepresentants;
            List <Element> deleted = new List <Element>(_deleted.Count());

            foreach (IModelElementRepresentant deletable in _deleted)
            {
                deleted.Add(ActiveDiagramView.ElementRepresentations.GetElementRepresentedBy(deletable));
            }
            DeleteFromModelMacroCommand c = (DeleteFromModelMacroCommand)DeleteFromModelMacroCommandFactory.Factory().Create(ModelController);

            c.Set(deleted, ActiveDiagramView.Controller);
            if (c.Commands.Count > 0)
            {
                c.Execute();
                ActiveDiagramView.SelectedItems.SetSelection();
            }
        }