public void ShowListing() { if (isInclude) { this.listBoxSelections.Rows.Clear(); var data = IncludeExcludeOptions.GetIncludedItems(); foreach (DataRow dr in data.Table.Rows) { DataGridViewRow row = (DataGridViewRow)this.listBoxSelections.Rows[0].Clone(); row.Cells[0].Value = dr["Path"].ToString(); row.Cells[1].Value = dr["ItemType"].ToString(); row.Cells[2].Value = dr["Id"].ToString(); listBoxSelections.Rows.Add(row); } } else { this.listBoxSelections.Rows.Clear(); var data = IncludeExcludeOptions.GetExcludedItems(); foreach (DataRow dr in data.Table.Rows) { DataGridViewRow row = (DataGridViewRow)this.listBoxSelections.Rows[0].Clone(); row.Cells[0].Value = dr["Path"].ToString(); row.Cells[1].Value = dr["ItemType"].ToString(); row.Cells[2].Value = dr["Id"].ToString(); listBoxSelections.Rows.Add(row); } } }
private void buttonOk_Click(object sender, EventArgs e) { string path = ""; string filterType = ""; int itemType = 1; if (!string.IsNullOrEmpty(this.textBoxFolderPath.Text)) { path = this.textBoxFolderPath.Text; itemType = 1; } else if (!string.IsNullOrEmpty(this.textBoxFilePath.Text)) { path = this.textBoxFilePath.Text; itemType = 2; } else if (!string.IsNullOrEmpty(this.textBoxRegistryKey.Text)) { path = this.textBoxRegistryKey.Text; itemType = 3; } if (!string.IsNullOrEmpty(this.textBoxFileTypeFilter.Text)) { filterType = this.textBoxFileTypeFilter.Text; } var result = IncludeExcludeOptions.AddNewItem(path, itemType, filterType, isInclude); if (IsInclude) { var control = this.Owner.Controls.Find("Include", true)[0] as UCIncludeExclude; control.ShowListing(); this.Close(); } var parent = this.Parent; }