Esempio n. 1
0
 /// <summary>
 /// Called when a connected client disconnects
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Instance_OnDisconnect(object sender, IDEventArgs e)
 {
     lock (Clients)
     {
         Clients.Remove(e.ID);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Called when a connected client sends it ID
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Instance_IDAvailable(object sender, IDEventArgs e)
        {
            ConnectedClient Instance = (ConnectedClient)sender;

            if (Clients.ContainsKey(e.ID))
            {
                Instance.TakeOverFrom(Clients[e.ID]);
            }
            lock (Clients)
            {
                Clients[e.ID] = Instance;
            }
            PendingClients.Remove(Instance);
        }