コード例 #1
0
        static void dragData_DragCompleted(object sender, MouseButtonEventArgs e)
        {
            DragButtonData dragData          = (DragButtonData)sender;
            PIM_Class      draggedClass      = ((PIM_Class)dragData.DraggedObject);
            XCaseCanvas    ActiveDiagramView = draggedClass.XCaseCanvas;

            dragData.DraggedObject.Visibility = Visibility.Hidden;
            ActiveDiagramView.Children.Remove(dragData.DraggedObject);
            ActiveDiagramView.State = ECanvasState.Normal;

            if (draggedClass.Left > 0 && draggedClass.Top > 0)
            {
                if (ActiveDiagramView.Diagram is PIMDiagram)
                {
                    ElementToDiagramCommand <Class, ClassViewHelper> command =
                        (ElementToDiagramCommand <Class, ClassViewHelper>)dragData.CommandFactory.Create(ActiveDiagramView.Controller);

                    command.ViewHelper.X    = draggedClass.Left;
                    command.ViewHelper.Y    = draggedClass.Top;
                    command.IncludedElement = new ElementHolder <Class> {
                        Element = (Class)draggedClass.ModelElement
                    };
                    command.Execute();
                }
                else if (ActiveDiagramView.Diagram is PSMDiagram)
                {
                    DerivePSMClassToDiagramCommand c = (DerivePSMClassToDiagramCommand)DerivePSMClassToDiagramCommandFactory.Factory().Create(ActiveDiagramView.Controller.ModelController);
                    c.Set(draggedClass.ClassController.Class, (PSMDiagram)ActiveDiagramView.Diagram);
                    if (c.CanExecute())
                    {
                        c.Execute();
                    }
                }
            }
        }
コード例 #2
0
        public void DerivePSMClassToDiagram(PSMDiagram d)
        {
            DerivePSMClassToDiagramCommand c =
                (DerivePSMClassToDiagramCommand)DerivePSMClassToDiagramCommandFactory.Factory().Create(DiagramController.ModelController);

            c.Set(Class, d);
            c.Execute();
        }
コード例 #3
0
        public override void Execute(object parameter)
        {
            PSMDiagram diagram = null;

            if (CurrentProject.PSMDiagrams.Count == 1)
            {
                diagram = CurrentProject.PSMDiagrams[0];
            }
            else if (CurrentProject.PSMDiagrams.Count > 1)
            {
                Dialogs.SelectPSMDiagramDialog d = new Dialogs.SelectPSMDiagramDialog();
                d.cmbDiagram.ItemsSource   = CurrentProject.PSMDiagrams;
                d.cmbDiagram.SelectedIndex = 0;
                if (d.ShowDialog() == true)
                {
                    diagram = d.cmbDiagram.SelectedValue as PSMDiagram;
                }
            }

            if (diagram == null)
            {
                return;
            }

            List <PIM_Class> List = new List <PIM_Class>();

            List.AddRange(ActiveDiagramView.SelectedItems.OfType <PIM_Class>());

            foreach (PIM_Class Class in List)
            {
                DerivePSMClassToDiagramCommand c = DerivePSMClassToDiagramCommandFactory.Factory().Create(CurrentProject.GetModelController()) as DerivePSMClassToDiagramCommand;
                c.Set(Class.ClassController.Class, diagram);
                if (c.CanExecute())
                {
                    c.Execute();
                }
            }
        }