public static void HandleGetSystemInfoResponse(Client client, GetSystemInfoResponse packet) { if (packet.SystemInfos == null) return; if (XMLSettings.ShowToolTip) { var builder = new StringBuilder(); for (int i = 0; i < packet.SystemInfos.Length; i += 2) { if (packet.SystemInfos[i] != null && packet.SystemInfos[i + 1] != null) { builder.AppendFormat("{0}: {1}\r\n", packet.SystemInfos[i], packet.SystemInfos[i + 1]); } } FrmMain.Instance.SetToolTipText(client, builder.ToString()); } if (client.Value == null || client.Value.FrmSi == null) return; ListViewItem[] lviCollection = new ListViewItem[packet.SystemInfos.Length / 2]; for (int i = 0, j = 0; i < packet.SystemInfos.Length; i += 2, j++) { if (packet.SystemInfos[i] != null && packet.SystemInfos[i + 1] != null) { lviCollection[j] = new ListViewItem(new string[] { packet.SystemInfos[i], packet.SystemInfos[i + 1] }); } } if (client.Value != null && client.Value.FrmSi != null) client.Value.FrmSi.AddItems(lviCollection); }
public static void HandleGetSystemInfoResponse(Client client, GetSystemInfoResponse packet) { if (XMLSettings.ShowToolTip) { try { FrmMain.Instance.lstClients.Invoke((MethodInvoker)delegate { foreach (ListViewItem item in FrmMain.Instance.lstClients.Items) { if (item.Tag == client) { var builder = new StringBuilder(); for (int i = 0; i < packet.SystemInfos.Length; i += 2) { if (packet.SystemInfos[i] != null && packet.SystemInfos[i + 1] != null) { builder.AppendFormat("{0}: {1}\r\n", packet.SystemInfos[i], packet.SystemInfos[i + 1]); } } item.ToolTipText = builder.ToString(); } } }); } catch { } } if (client.Value.FrmSi == null) return; ListViewItem[] lviCollection = new ListViewItem[packet.SystemInfos.Length/2]; for (int i = 0, j = 0; i < packet.SystemInfos.Length; i += 2, j++) { if (packet.SystemInfos[i] != null && packet.SystemInfos[i + 1] != null) { lviCollection[j] = new ListViewItem(new string[] {packet.SystemInfos[i], packet.SystemInfos[i + 1]}); } } try { client.Value.FrmSi.Invoke((MethodInvoker) delegate { client.Value.FrmSi.lstSystem.Items.RemoveAt(2); // Loading... Information foreach (var lviItem in lviCollection) { if (lviItem != null) client.Value.FrmSi.lstSystem.Items.Add(lviItem); } ListViewExtensions.AutosizeColumns(client.Value.FrmSi.lstSystem); }); } catch { } }