public static string GetShortHardwareInfoToSend() { ShortSystemModel systemModel = GetShortSystemModel().Result; string finalMessage = $"<system><Name>{systemModel.SystemName}<CPU>{systemModel.Cpu}</system>"; return(finalMessage); }
private async Task UpdateLocalNodesInfo() { //Getting connected systems IpAddressManagement ipManagement = new IpAddressManagement(); var localIps = await ipManagement.StartGettingHosts(_ipAddress); await Task.Run(() => { foreach (string ip in localIps) { //Starting client AsynchronousClient client = new AsynchronousClient(); string recievedMessage = client.StartClient("/getshort", ip); if (recievedMessage.Contains("<system>")) { //Get short system model ShortSystemModel systemModel = ManageSystemInformations.ConvertMessageToShortSystemModel(recievedMessage); systemModel.SystemIp = ip; //Adding system to data grid view if (this.nodesDataGrid.InvokeRequired) { nodesDataGrid.Invoke(new Action(() => { nodesDataGrid.Rows.Add(systemModel.SystemIp, systemModel.SystemName, systemModel.Cpu); })); } else { nodesDataGrid.Rows.Add(systemModel.SystemIp, systemModel.SystemName, systemModel.Cpu); } } else { //This happens when getting message from other system fails //Adding system to data grid view if (this.nodesDataGrid.InvokeRequired) { nodesDataGrid.Invoke(new Action(() => { nodesDataGrid.Rows.Add(ip, "", ""); })); } else { nodesDataGrid.Rows.Add(ip, "", ""); } } } }); }