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
 /// <summary>
 /// Handles double click on a diagram in Projects window - activates/reopens the tab with selected diagram
 /// </summary>
 internal void DiagramDoubleClick(object sender, DiagramDClickArgs arg)
 {
     ActivateDiagram(arg.Diagram);
 }