// Called during drag-drop to determine whether the supplied source and target combination is valid.
        internal static bool CanAcceptSourceAndTarget(ModelElement sourceElement, ModelElement targetElement)
        {
            SocketUse socketUse = sourceElement as SocketUse ?? targetElement as SocketUse;
            Socket    socket    = sourceElement as Socket ?? targetElement as Socket;

            if (socket == null || socketUse == null)
            {
                return(false);
            }

            return(socketUse.CanConnectTo(socket));
        }
예제 #2
0
        private static void PushPosibleConnections(IEnumerable <Socket> sockets, SocketUse socketUse, Stack <PossibleConnection> stack)
        {
            foreach (var socket in sockets)
            {
                if (socket.SocketUse != null)
                {
                    continue;
                }

                if (socketUse.CanConnectTo(socket))
                {
                    stack.Push(new PossibleConnection()
                    {
                        Socket = socket, SocketUse = socketUse
                    });
                }
            }
        }