コード例 #1
0
        internal static List <ConnectionPoint> GetEmptyConnectionPoints(UIElement designer)
        {
            List <ConnectionPoint> connectionPoints = StateContainerEditor.GetConnectionPoints(designer);

            if (connectionPoints != null)
            {
                return(new List <ConnectionPoint>(connectionPoints.Where <ConnectionPoint>(
                                                      (p) => { return p.AttachedConnectors == null || p.AttachedConnectors.Count == 0; })));
            }
            return(new List <ConnectionPoint>());
        }
コード例 #2
0
        static ConnectionPoint ConnectionPointHitTest(UIElement element, Point hitPoint)
        {
            ConnectionPoint        hitConnectionPoint = null;
            List <ConnectionPoint> connectionPoints   = StateContainerEditor.GetConnectionPoints(element);

            foreach (ConnectionPoint connPoint in connectionPoints)
            {
                if (connPoint != null)
                {
                    // We need to transform the connection point location to be relative to the outmost panel
                    FreeFormPanel panel = GetVisualAncestor <FreeFormPanel>(element);
                    if (new Rect(panel.GetLocationRelativeToOutmostPanel(connPoint.Location) + connPoint.HitTestOffset, connPoint.HitTestSize).Contains(hitPoint))
                    {
                        hitConnectionPoint = connPoint;
                        break;
                    }
                }
            }
            return(hitConnectionPoint);
        }
コード例 #3
0
        //This returns the closest non-outgoing connectionPoint on dest. Return value will be different than sourceConnectionPoint.
        static ConnectionPoint GetClosestDestConnectionPoint(ConnectionPoint sourceConnectionPoint, UIElement dest)
        {
            ConnectionPoint destConnectionPoint = null;

            if (sourceConnectionPoint.PointType != ConnectionPointType.Incoming)
            {
                destConnectionPoint = GetClosestConnectionPointNotOfType(sourceConnectionPoint, StateContainerEditor.GetConnectionPoints(dest), ConnectionPointType.Outgoing);
            }
            return(destConnectionPoint);
        }
コード例 #4
0
        //This returns the closest non-incoming connectionPoint on source. Return value will be different than destConnectionPoint.
        static ConnectionPoint GetClosestSrcConnectionPoint(UIElement src, ConnectionPoint destConnectionPoint)
        {
            ConnectionPoint srcConnectionPoint = null;

            if (destConnectionPoint.PointType != ConnectionPointType.Outgoing)
            {
                srcConnectionPoint = GetClosestConnectionPointNotOfType(destConnectionPoint, StateContainerEditor.GetConnectionPoints(src), ConnectionPointType.Incoming);
            }
            return(srcConnectionPoint);
        }