private void cmdAdd_Click(object sender, EventArgs e) { EditDirectory editDirectory = new EditDirectory(); if (editDirectory.ShowDirectoryDetail() == DialogResult.OK) { ListViewItem lvi = new ListViewItem(editDirectory.SelectedDirectoryFilterEntry.FilterFullPath); lvi.SubItems.Add(editDirectory.SelectedDirectoryFilterEntry.CountWarningIndicator.ToString()); lvi.SubItems.Add(editDirectory.SelectedDirectoryFilterEntry.CountErrorIndicator.ToString()); lvi.SubItems.Add(editDirectory.SelectedDirectoryFilterEntry.SizeKBWarningIndicator.ToString()); lvi.SubItems.Add(editDirectory.SelectedDirectoryFilterEntry.SizeKBErrorIndicator.ToString()); lvi.SubItems.Add(editDirectory.SelectedDirectoryFilterEntry.FileMinAgeSec.ToString()); lvi.SubItems.Add(editDirectory.SelectedDirectoryFilterEntry.FileMaxAgeSec.ToString()); lvi.SubItems.Add(editDirectory.SelectedDirectoryFilterEntry.FileMinSizeKB.ToString()); lvi.SubItems.Add(editDirectory.SelectedDirectoryFilterEntry.FileMaxSizeKB.ToString()); lvi.Tag = editDirectory.SelectedDirectoryFilterEntry; lvwDirectories.Items.Add(lvi); } }
private void cmdEdit_Click(object sender, EventArgs e) { if (lvwDirectories.SelectedItems.Count > 0) { EditDirectory editDirectory = new EditDirectory(); editDirectory.SelectedDirectoryFilterEntry = (DirectoryFilterEntry)lvwDirectories.SelectedItems[0].Tag; if (editDirectory.ShowDirectoryDetail() == DialogResult.OK) { ListViewItem lvi = lvwDirectories.SelectedItems[0]; lvi.Text = editDirectory.SelectedDirectoryFilterEntry.FilterFullPath; lvi.SubItems[1].Text = editDirectory.SelectedDirectoryFilterEntry.CountWarningIndicator.ToString(); lvi.SubItems[2].Text = editDirectory.SelectedDirectoryFilterEntry.CountErrorIndicator.ToString(); lvi.SubItems[3].Text = editDirectory.SelectedDirectoryFilterEntry.SizeKBWarningIndicator.ToString(); lvi.SubItems[4].Text = editDirectory.SelectedDirectoryFilterEntry.SizeKBErrorIndicator.ToString(); lvi.SubItems[5].Text = editDirectory.SelectedDirectoryFilterEntry.FileMinAgeSec.ToString(); lvi.SubItems[6].Text = editDirectory.SelectedDirectoryFilterEntry.FileMaxAgeSec.ToString(); lvi.SubItems[7].Text = editDirectory.SelectedDirectoryFilterEntry.FileMinSizeKB.ToString(); lvi.SubItems[8].Text = editDirectory.SelectedDirectoryFilterEntry.FileMaxSizeKB.ToString(); lvi.Tag = editDirectory.SelectedDirectoryFilterEntry; } } }