Пример #1
0
 public static EntryType GetForEntry(EntryViewModel m) => m.MessageEntry == null ? EntryType.Receiver : EntryType.Message;
        public void ConnectionDragCompleted(MessagePathViewModel newConnection, EntryViewModel connectorDraggedOut, EntryViewModel connectorDraggedOver)
        {
            if (connectorDraggedOver == null)
            {
                this.Network.Connections.Remove(newConnection);
                return;
            }
            var connectionOk = connectorDraggedOut.ParentNode != connectorDraggedOver.ParentNode &&
                               connectorDraggedOut.Type != connectorDraggedOver.Type;

            if (!connectionOk)
            {
                this.Network.Connections.Remove(newConnection);
                return;
            }
            var existingConnection = FindConnection(connectorDraggedOut, connectorDraggedOver);

            if (existingConnection != null)
            {
                this.Network.Connections.Remove(existingConnection);
            }
            if (newConnection.DestConnector == null)
            {
                newConnection.DestConnector = connectorDraggedOver;
            }
            else
            {
                newConnection.SourceConnector = connectorDraggedOver;
            }
        }