Пример #1
0
        public static void HandleGetSystemInfoResponse(Client client, GetSystemInfoResponse packet)
        {
            if (client.Value.FrmSi == null)
            {
                return;
            }

            ListViewItem[] lviCollection = new ListViewItem[packet.SystemInfos.Length / 2];
            int            j             = 0;

            for (int i = 0; i < packet.SystemInfos.Length; i += 2)
            {
                if (packet.SystemInfos[i] != null && packet.SystemInfos[i + 1] != null)
                {
                    lviCollection[j] = new ListViewItem(new string[] { packet.SystemInfos[i], packet.SystemInfos[i + 1] });
                    j++;
                }
            }

            if (client.Value.FrmSi == null)
            {
                return;
            }

            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
            { }
        }
Пример #2
0
        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
            {
            }
        }