private async Task ShowConnectedNodes(string ipAddress) { NodesList.Items.Clear(); IpAddressManagement ipManagement = new IpAddressManagement(); NodesList.Items.AddRange(await ipManagement.StartGettingHosts(ipAddress)); }
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, "", ""); } } } }); }