Exemplo n.º 1
0
 /// <summary>
 /// Handles diagram removing event invoked by Projects window
 /// </summary>
 internal void DiagramRemoveHandler(object sender, DiagramDClickArgs arg)
 {
     if (arg.Diagram is PIMDiagram)
     {
         RemoveDiagramCommand removeDiagramCommand = (RemoveDiagramCommand)RemoveDiagramCommandFactory.Factory().Create(arg.Diagram.Project.GetModelController());
         removeDiagramCommand.Set(arg.Diagram.Project, arg.Diagram);
         removeDiagramCommand.Execute();
     }
     else if (arg.Diagram is PSMDiagram)
     {
         PanelWindow Tab = FindTab(arg.Diagram);
         if (Tab != null)
         {
             RemovePSMDiagramMacroCommand c = (RemovePSMDiagramMacroCommand)RemovePSMDiagramMacroCommandFactory.Factory().Create(arg.Diagram.Project.GetModelController());
             c.Set(arg.Diagram.Project, arg.Diagram as PSMDiagram, Tab.xCaseDrawComponent.Canvas.Controller);
             if (c.Commands.Count > 0)
             {
                 c.Execute();
             }
         }
         else
         {
             RemovePSMDiagramMacroCommand c = (RemovePSMDiagramMacroCommand)RemovePSMDiagramMacroCommandFactory.Factory().Create(MainWindow.CurrentProject.GetModelController());
             c.Set(arg.Diagram.Project, arg.Diagram as PSMDiagram, new DiagramController(arg.Diagram as PSMDiagram, MainWindow.CurrentProject.GetModelController()));
             if (c.Commands.Count > 0)
             {
                 c.Execute();
             }
         }
     }
     else
     {
         throw new NotImplementedException("Unknown diagram type");
     }
 }
Exemplo n.º 2
0
 public override void Execute(object parameter)
 {
     if (ActiveDiagramView.Diagram is PIMDiagram)
     {
         RemoveDiagramCommand c = RemoveDiagramCommandFactory.Factory().Create(CurrentProject.GetModelController()) as RemoveDiagramCommand;
         c.Set(CurrentProject, ActiveDiagramView.Diagram as PIMDiagram);
         c.Execute();
     }
     else if (ActiveDiagramView.Diagram is PSMDiagram)
     {
         RemovePSMDiagramMacroCommand c = RemovePSMDiagramMacroCommandFactory.Factory().Create(CurrentProject.GetModelController()) as RemovePSMDiagramMacroCommand;
         c.Set(CurrentProject, ActiveDiagramView.Diagram as PSMDiagram, ActiveDiagramView.Controller);
         if (c.Commands.Count > 0)
         {
             c.Execute();
         }
     }
     else
     {
         throw new NotImplementedException();
     }
 }