コード例 #1
0
        private void OnNewFileName(InterfaceFileNames fileName)
        {
            ListViewItem itemFileName = new ListViewItem(new string[] { "", "" });

            FileNameToItem(fileName, itemFileName);
            Items.Add(itemFileName);
        }
コード例 #2
0
 private void FileNameToItem(InterfaceFileNames fileName, ListViewItem itemFileName)
 {
     /*if (fileName==null) return;
      * if (itemFileName.SubItems[0].Text!=fileName.FileName) itemFileName.SubItems[0].Text=fileName.FileName;
      * if (itemFileName.SubItems[1].Text!=fileName.nClients.ToString()) itemFileName.SubItems[1].Text=fileName.nClients.ToString();
      */
     itemFileName.Tag = fileName;
     if (itemFileName.SubItems[0].Text != fileName.FileName)
     {
         itemFileName.SubItems[0].Text = fileName.FileName;
     }
     if (itemFileName.SubItems[1].Text != fileName.nClients.ToString())
     {
         itemFileName.SubItems[1].Text = fileName.nClients.ToString();
     }
 }
コード例 #3
0
        private void m_UpdateOrAddFilename(InterfaceFileNames fileName)
        {
            bool updated = false;

            foreach (ListViewItem itemFileName in this.Items)
            {
                if (itemFileName.Text == fileName.FileName)
                {
                    if (itemFileName.SubItems[1].Text != fileName.nClients.ToString())
                    {
                        itemFileName.SubItems[1].Text = fileName.nClients.ToString();
                    }
                    itemFileName.Tag = fileName;
                    updated          = true;
                    break;
                }
            }
            if (!updated)
            {
                OnNewFileName(fileName);
            }
        }