private void OnNewFileName(InterfaceFileNames fileName) { ListViewItem itemFileName = new ListViewItem(new string[] { "", "" }); FileNameToItem(fileName, itemFileName); Items.Add(itemFileName); }
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(); } }
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); } }