Example #1
0
        void ProcessEntity(object data, Point point)
        {
            var control = DesignManager.CreateDesignControl(data);

            Canvas.SetLeft(control, point.X);
            Canvas.SetTop(control, point.Y);
            Draw(control);
            if (DesignManager.IsAutoConnectNode != null && DesignManager.IsAutoConnectNode())
            {
                AutoAddConnection(control);
            }
        }
Example #2
0
        void ProcessLink(object data, Point point)
        {
            if (data == null)
            {
                return;
            }

            var l = DesignManager.GetDesignLink(data);

            if (l == null)
            {
                return;
            }

            var s = GetItemByID(l.Item1);
            var t = GetItemByID(l.Item2);

            if (s == null && t == null)
            {
                CommonProc.ShowMessage("Error", "Link source item and target item does not exist in diagram");
                return;
            }
            if (s == null)
            {
                var control = DesignManager.CreateDesignControl(s);
                Canvas.SetLeft(control, point.X);
                Canvas.SetTop(control, point.Y);
                Draw(control);
                if (DesignManager.IsAutoConnectNode != null && DesignManager.IsAutoConnectNode())
                {
                    AutoAddConnection(control);
                }
            }
            if (t == null)
            {
                var control = DesignManager.CreateDesignControl(t);
                Canvas.SetLeft(control, point.X);
                Canvas.SetTop(control, point.Y);
                Draw(control);
                if (DesignManager.IsAutoConnectNode != null && DesignManager.IsAutoConnectNode())
                {
                    AutoAddConnection(control);
                }
            }
            Connect(l);
        }