コード例 #1
0
ファイル: Controller.cs プロジェクト: sujingxd/wpf0606
        public void UpdateLink(LinkInfo initialState, Aga.Diagrams.Controls.ILink link)
        {
            using (BeginUpdate())
            {
                var sourcePort = link.Source as PortBase;
                var source     = VisualHelper.FindParent <Node>(sourcePort);
                var targetPort = link.Target as PortBase;
                var target     = VisualHelper.FindParent <Node>(targetPort);
                var oldLink    = (link as LinkBase).ModelElement as Link;
                var message    = "";
                var action     = "";
                if (null != oldLink)
                {
                    message = ((link as LinkBase).ModelElement as Link).Message;
                    action  = ((link as LinkBase).ModelElement as Link).Action;
                }

                _model.Links.Remove((link as LinkBase).ModelElement as Link);
                _model.Links.Add(
                    new Link((FlowNode)source.ModelElement, (PortKinds)sourcePort.Tag,
                             (FlowNode)target.ModelElement, (PortKinds)targetPort.Tag,
                             link.ControlPoint1, link.ControlPoint2, message, action
                             ));
            }
        }
コード例 #2
0
        public void UpdateLink(LinkInfo initialState, Aga.Diagrams.Controls.ILink link)
        {
            using (BeginUpdate())
            {
                var sourcePort = link.Source as PortBase;
                var source     = VisualHelper.FindParent <Node>(sourcePort);
                var targetPort = link.Target as PortBase;
                var target     = VisualHelper.FindParent <Node>(targetPort);

                _model.Links.Remove((link as LinkBase).ModelElement as Link);
                _model.Links.Add(
                    new Link((FlowNode)source.ModelElement, (PortKinds)sourcePort.Tag,
                             (FlowNode)target.ModelElement, (PortKinds)targetPort.Tag
                             ));
            }
        }