示例#1
0
 private void ReceiveHubDisconnectClientRequest(dynamic jsonData)
 {
     if (!Authentication.Current.Keys.Any(x => x.Key == jsonData["HubKey"]?.Trim()?.ToLower()))
     {
         ConnectionToClient.Close();
         return;
     }
     foreach (var clientID in jsonData["Clients"])
     {
         var client = AditServer.ClientList.Find(x => x.ID == clientID);
         if (client != null)
         {
             AditServer.ClientList.Remove(client);
             client.Socket.Close();
         }
     }
     SendHubDataRequest(jsonData["HubKey"]);
 }
示例#2
0
 private void ReceiveHubDeleteClientRequest(dynamic jsonData)
 {
     if (!Authentication.Current.Keys.Any(x => x.Key == jsonData["HubKey"]?.Trim()?.ToLower()))
     {
         ConnectionToClient.Close();
         return;
     }
     MainWindow.Current.Dispatcher.Invoke(() => {
         foreach (var client in jsonData["Clients"])
         {
             var computer = AditHub.Current.ComputerList.FirstOrDefault(x => x.ID == client);
             if (computer != null)
             {
                 AditHub.Current.ComputerList.Remove(computer);
             }
         }
         SendHubDataRequest(jsonData["HubKey"]);
     });
 }