public void Connect(ViewNodeControl startNode, ViewNodeControl endNode)
 {
     if (startNode == null)
     {
         throw new ArgumentNullException("StartNode");
     }
     if (endNode == null)
     {
         throw new ArgumentException("EndNode");
     }
     StartNode = startNode;
     EndNode   = endNode;
     Drawable  = new ConnectorDrawingObject(StartNode.GetOutgoingEdgePosition, EndNode.GetIncomingEdgePosition);
 }
Exemple #2
0
        public void InitMockup()
        {
            var viewNode = new ViewNodeControl()
            {
                Width = 100, Height = 50, Title = "First", AllowDrop = true
            };

            viewNode.HighlightAdorner = new HighlightAdorner(viewNode);
            viewNode.LinkAdorner      = new LinkAdorner(viewNode);
            viewNode.Drop            += LinkAction;

            viewNode.IsSelectedChanged += (node, isSelected) => {
                if (isSelected)
                {
                    NodesList.ToList().ForEach(n => { if (n.Equals(node) == false)
                                                      {
                                                          (n as ISelectable).IsSelected = false;
                                                      }
                                               });
                }
            };

            NodesList = new ObservableCollection <UIElement>();
            NodesList.Add(viewNode);

            viewNode = new ViewNodeControl()
            {
                Width = 100, Height = 50, Title = "Second", AllowDrop = true
            };
            viewNode.HighlightAdorner = new HighlightAdorner(viewNode);
            viewNode.LinkAdorner      = new LinkAdorner(viewNode);
            viewNode.Drop            += LinkAction;

            viewNode.IsSelectedChanged += (node, isSelected) => {
                if (isSelected)
                {
                    NodesList.ToList().ForEach(n => { if (n.Equals(node) == false)
                                                      {
                                                          (n as ISelectable).IsSelected = false;
                                                      }
                                               });
                }
            };
            NodesList.Add(viewNode);
        }