private void EnumDirectory(string path) { List<string> files = FileUtility.SearchDirectory(path, "*.*"); foreach (string file in files) { if (FileUtility.IsDirectory(file)) EnumDirectory(file); else { UpgradeItem upItem = new UpgradeItem(file); ListViewItem item = new ListViewItem(upItem.Name, 1); item.Tag = upItem; lvItems.Items.Add(item); } } }
private void btniAdd_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { OpenFileDialog opendlg = new OpenFileDialog(); opendlg.Multiselect = true; opendlg.Title = "ѡ�������Ŀ"; opendlg.Filter = "���г���(*.*)|*.*"; if (opendlg.ShowDialog() == DialogResult.OK) { foreach (string file in opendlg.FileNames) { if (FileUtility.IsDirectory(file)) { EnumDirectory(file); } else { UpgradeItem upItem = new UpgradeItem(file); ListViewItem item = new ListViewItem(upItem.Name, 1); item.Tag = upItem; lvItems.Items.Add(item); } } upgradeItemChanged = true; } }