private void btnClearList_Click(object sender, EventArgs e) { SpecFiles.Clear(); chkListFullPath_CheckedChanged(chkListFullPath, new EventArgs()); dt = null; treeView1.Nodes.Clear(); }
private void AddSpecFiles(string[] fileNames) { bool isAvl = false; string[] extArr = testExtn.Replace("*", "").Split(new char[] { ';' }); foreach (string fname in fileNames) { if (SpecFiles.Where(f => f.Equals(fname)).Count() <= 0 && extArr.Where(fn => fname.EndsWith(fn)).Count() > 0) { SpecFiles.Add(fname); } else { isAvl = true; SpecFiles.Add(fname); } } if (isAvl) { MessageBox.Show(string.Format("{0}{3}{1}{3}{2}", "Some of the files are not added ", "1. It is already available in the list", "2. Or the selected file is not a spec file", Environment.NewLine)); } //SpecFiles.AddRange(openFileDialog1.FileNames); chkListFullPath_CheckedChanged(chkListFullPath, new EventArgs()); }
private void DeleteSelectedSpecs() { string selectedItem; if (MessageBox.Show("Do you want to remove this item ?", "Remove Item", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes) { for (int i = lstFiles.SelectedItems.Count - 1; i >= 0; i--) { selectedItem = lstFiles.SelectedItems[i].ToString(); SpecFiles.Remove(SpecFiles.Find(f => f.Contains(selectedItem))); lstFiles.Items.Remove(lstFiles.SelectedItems[i]); } if (treeView1.Nodes.Count > 0) { btnCreateTree_Click(btnCreateTree, new EventArgs { }); } } }