public override void Undo()
        {
            var model        = _createdEditor.Model;
            var containerCtl = _target.Controller as IContainerController;

            if (containerCtl != null)
            {
                _target.RemoveChildEditor(_createdEditor);
                containerCtl.RemoveChild(model);
                _createdEditor.Disable();
                _createdEditor.Controller.DisposeModel(model);
            }
        }
Exemple #2
0
        public override void Undo()
        {
            var model        = _createdEditor.Model;
            var containerCtl = _target.Controller as IContainerController;
            var edge         = _createdEditor.Figure as IEdge;

            if (containerCtl != null)
            {
                /// 切断
                var createdConnectionCtrl = _createdEditor.Controller as IConnectionController;
                if (edge.IsSourceConnected)
                {
                    var srcConnectableCtrl = _edgeSourceEditor == null ?
                                             null :
                                             _edgeSourceEditor.Controller as IConnectableController;
                    edge.Source = null;
                    createdConnectionCtrl.DisconnectSource();
                    srcConnectableCtrl.DisconnectOutgoing(model);
                }
                if (edge.IsTargetConnected)
                {
                    var tgtConnectableCtrl = _edgeTargetEditor == null ?
                                             null :
                                             _edgeTargetEditor.Controller as IConnectableController;
                    edge.Target = null;
                    createdConnectionCtrl.DisconnectTarget();
                    tgtConnectableCtrl.DisconnectIncoming(model);
                }

                _target.RemoveChildEditor(_createdEditor);
                containerCtl.RemoveChild(model);
                _createdEditor.Disable();
                _createdEditor.Controller.DisposeModel(model);
            }

            edge.TargetConnectionOption = _oldTargetAnchorId;

            if (_oldStyledText != null)
            {
                var tgtModel = _edgeTargetEditor.Model as MemoText;
                tgtModel.StyledText = _oldStyledText;
            }
        }
Exemple #3
0
        // ========================================
        // method
        // ========================================
        public override void Execute()
        {
            _target.IsSelected = false;

            _oldParent      = _target.Parent;
            _oldEditorIndex = _oldParent.Children.IndexOf(_target);

            var parentCtrl = _oldParent.Controller as IContainerController;

            _oldModelIndex = parentCtrl.Children.IndexOf(_target.Model);

            _disconnCommand = CreateDisconnCommand();
            _disconnCommand.Execute();

            var model = _target.Model;

            _target.Disable();
            _oldParent.RemoveChild(model);
            _target.Controller.DisposeModel(model);
        }