Exemplo n.º 1
0
 private void OnElementConnected(ElementConnectEventArgs e)
 {
     if (ElementConnected != null)
     {
         ElementConnected(this, e);
     }
 }
Exemplo n.º 2
0
 private void OnElementConnecting(ElementConnectEventArgs e)
 {
     if (ElementConnecting != null)
     {
         ElementConnecting(this, e);
     }
 }
Exemplo n.º 3
0
 protected virtual void OnElementConnected(ElementConnectEventArgs e)
 {
     if (ElementConnected != null)
     {
         ElementConnected(this, e);
     }
 }
Exemplo n.º 4
0
        public bool OnElementConnected(Designer designer, ElementConnectEventArgs e)
        {
            if (e.Link.Connector1.IsStart == e.Link.Connector2.IsStart)
            {
                designer.Document.DeleteLink(e.Link, false);
                return(false);
            }
            if (e.Link.Connector1.IsStart)
            {
                var con1 = e.Link.Connector1;
                e.Link.Connector1 = e.Link.Connector2;
                e.Link.Connector2 = con1;
                e.Link.Invalidate();
            }
            for (var i = designer.Document.Elements.Count - 1; i >= 0; i--)
            {
                if (e.Link == designer.Document.Elements[i] || !(designer.Document.Elements[i] is BaseLinkElement))
                {
                    continue;
                }
                var link = (BaseLinkElement)designer.Document.Elements[i];
                if (link.Connector2 == e.Link.Connector2)
                {
                    designer.Document.DeleteLink(link, false);
                }
            }

            return(true);
        }
Exemplo n.º 5
0
        private void DesignerElementConnected(object sender, ElementConnectEventArgs e)
        {
            DocumentModel.Touch();
            var node1 = (BlockNodeBase)e.Link.Connector1.State;
            var node2 = (BlockNodeBase)e.Link.Connector2.State;

            node1.ConnectTo(ref node2);
            try
            {
                node1.Root.Execute();
                Designer.Document.SelectElement(e.Link.Connector2);
            }
            catch (StackOverflowException)
            {
                MessageBox.Show(DesignerResources.ModelThrewStackOverflow);
            }
        }
Exemplo n.º 6
0
        private void EndAddLink()
        {
            if (_connEnd != _linkLine.Connector2)
            {
                _linkLine.Connector1.RemoveLink(_linkLine);
                _linkLine = _document.AddLink(_linkLine.Connector1, _linkLine.Connector2);
                var eventArgs = new ElementConnectEventArgs(_linkLine.Connector1.ParentElement, _linkLine.Connector2.ParentElement, _linkLine);
                var accepted  = true;
                if (_linkLine.Connector1.ParentElement is DiagramBlock)
                {
                    accepted = (_linkLine.Connector1.ParentElement as DiagramBlock).OnElementConnected(this, eventArgs);
                }
                if (accepted)
                {
                    OnElementConnected(eventArgs);
                }
            }

            _connStart = null;
            _connEnd   = null;
            _linkLine  = null;
        }