コード例 #1
0
ファイル: ClientsTableForm.cs プロジェクト: danorama/pace
        private void UpdateClientTable()
        {
            if (clientListView.InvokeRequired)
            {
                var d = new UpdateClientTableCallback(UpdateClientTable);
                this.Invoke(d, new object[] {});
            }
            else
            {
                clientListView.BeginUpdate();
                var ctall = _connectionTable.GetAll();

                clientListView.Items.Clear();

                foreach (ConnectionTable.ClientInformation ct in ctall)
                {
                    ListViewItem listViewItem;
                    switch (ct.GetGroup())
                    {
                    case "server":
                        listViewItem =
                            new ListViewItem(
                                new string[]
                        {
                            ct.GetName(), ct.GetPerformance(), ct.GetMessagesInQueue().ToString(),
                            ct.GetApplicationNames()
                        }, 0)
                        {
                            Group = _server, Checked = ct.GetChecked(), Selected = ct.GetSelected()
                        };
                        break;

                    case "remote":
                        listViewItem =
                            new ListViewItem(
                                new string[]
                        {
                            ct.GetName(), ct.GetPerformance(), ct.GetMessagesInQueue().ToString(),
                            ct.GetApplicationNames()
                        }, 0)
                        {
                            Group = _remote, Checked = ct.GetChecked(), Selected = ct.GetSelected()
                        };
                        break;

                    default:
                        listViewItem =
                            new ListViewItem(
                                new string[]
                        {
                            ct.GetName(), ct.GetPerformance(), ct.GetMessagesInQueue().ToString(),
                            ct.GetApplicationNames()
                        }, 0)
                        {
                            Group = _local, Checked = ct.GetChecked(), Selected = ct.GetSelected()
                        };
                        break;
                    }

                    clientListView.Items.Add(listViewItem);
                }
                clientListView.EndUpdate();
            }
        }