コード例 #1
0
        public void AddOrUpdateItem(MaximusParserX.Reading.Readers.ReaderBase readerbase)
        {
            if (this.InvokeRequired)
            {
                this.Invoke(new DelegateManager.DelegateAddOrUpdateItem<MaximusParserX.Reading.Readers.ReaderBase>(AddOrUpdateItem), readerbase);
            }
            else
            {
                var key = readerbase.ReaderGUID.ToString();

                ListViewItem listviewitem = null;

                if (!lstView.Items.ContainsKey(key))
                {
                    listviewitem = lstView.Items.Add(key, readerbase.Name, 0);
                    listviewitem.SubItems.Add(readerbase.TypeName);
                    listviewitem.SubItems.Add(readerbase.CreatedDateTime.ToString("MM/dd/yyyy"));
                    listviewitem.SubItems.Add(readerbase.FileSize);
                    listviewitem.SubItems.Add(readerbase.PacketTotalCount.ToString());
                    listviewitem.SubItems.Add(readerbase.ClientBuildName);
                }
                else
                {
                    listviewitem = lstView.Items[key];
                    listviewitem.SubItems[0].Text = readerbase.Name;
                    listviewitem.SubItems[1].Text = readerbase.TypeName;
                    listviewitem.SubItems[2].Text = readerbase.CreatedDateTime.ToString("MM/dd/yyyy");
                    listviewitem.SubItems[3].Text = readerbase.FileSize;
                    listviewitem.SubItems[4].Text = readerbase.PacketTotalCount.ToString();
                    listviewitem.SubItems[5].Text = readerbase.ClientBuildName;
                }

                listviewitem.Tag = readerbase.FileName;

                readerbase.Close();
            }
        }