Beispiel #1
0
        ///<inheritdoc/>
        public void AddConnectionListener(IRemoteConnectionListener listener, bool immediateNotify)
        {
            if (m_connectionListenerMap.ContainsKey(listener))
            {
                throw new ArgumentException("Cannot add the same listener twice", nameof(listener));
            }

            ConnectionListenerCallback func = (uid, connected, conn) =>
            {
                if (connected)
                {
                    listener.Connected(this, conn);
                }
                else
                {
                    listener.Disconnected(this, conn);
                }
            };
            int id = NtCore.AddConnectionListener(func, immediateNotify);

            m_connectionListenerMap.Add(listener, id);
        }
Beispiel #2
0
 public ConnectionNotification(bool connected, ConnectionInfo connInfo, ConnectionListenerCallback only)
 {
     Connected = connected;
     ConnInfo  = connInfo;
     Only      = only;
 }