Ejemplo n.º 1
0
        public override void Execute(object parameter)
        {
            ActiveDiagramView.State = ECanvasState.DraggingElement;

            ActiveDiagramView.Cursor = Cursors.Hand;
            dragData = PrepareButtonData();
            dragData.DragCompleted += dragData_DragCompleted;
            ActiveDiagramView.Children.Add(dragData.DraggedObject);
            DragButtonData classButtonData = dragData;

            classButtonData.AssociateWithControl(Control);
            ActiveDiagramView.draggingElementState.DragData = classButtonData;
            classButtonData.DraggedObject.Visibility        = Visibility.Hidden;
            classButtonData.Sender = Control;
            ActiveDiagramView.CaptureMouse();
        }
Ejemplo n.º 2
0
        public static void Executed(object sender, ExecutedRoutedEventArgs e)
        {
            PIMClass    modelClass        = (PIMClass)(((StackPanel)((Button)e.OriginalSource).Parent).DataContext);
            XCaseCanvas ActiveDiagramView = ((MainWindow)sender).ActiveDiagram;

            if (ActiveDiagramView != null && !ActiveDiagramView.ElementRepresentations.IsElementPresent(modelClass) && !(modelClass is AssociationClass))
            {
                ActiveDiagramView.State = ECanvasState.DraggingElement;

                PIM_Class draggedObject = new PIM_Class(ActiveDiagramView);
                draggedObject.InitializeRepresentant(modelClass, new ClassViewHelper(ActiveDiagramView.Diagram), new ClassController(modelClass, ActiveDiagramView.Controller));

                DragButtonData dragData = new DragButtonData(ElementToDiagramCommandFactory <Class, ClassViewHelper> .Factory(), draggedObject);
                dragData.DragCompleted += dragData_DragCompleted;

                DragButtonData classButtonData = dragData;
                classButtonData.AssociateWithControl((Button)e.OriginalSource);
                ActiveDiagramView.draggingElementState.DragData = classButtonData;
                classButtonData.DraggedObject.Visibility        = Visibility.Hidden;
                classButtonData.Sender = (Button)e.OriginalSource;
                ActiveDiagramView.CaptureMouse();
            }
        }