Пример #1
0
 void SetDir(FileInfo fi)
 {
     foreach (ListViewItem lvi in listView1.Items)
     {
         ((FileInfo)lvi.Tag).ListViewItem = null;
     }
     listView1.Items.Clear();
     string[] files = vol.GetFiles(fi.FullPath);
     foreach (TreeNode tn in fi.TreeNode.Nodes)
     {
         FileInfo     fi1 = (FileInfo)tn.Tag;
         ListViewItem ll  = new ListViewItem(tn.Text, 1, listView1.Groups[0]);
         fi1.ListViewItem = ll;
         ll.Tag           = fi1;
         listView1.Items.Add(ll);
     }
     foreach (string s in files)
     {
         FileInfo fi1 = new FileInfo();
         fi1.ListViewItem     = new ListViewItem(s, 0, listView1.Groups[1]);
         fi1.FileName         = s;
         fi1.FullPath         = fi.FullPath + "\\" + s;
         fi1.ListViewItem.Tag = fi1;
         listView1.Items.Add(fi1.ListViewItem);
     }
     statusStrip1.Items[0].Text = string.Format("{0} item(s)", listView1.Items.Count);
     toolStripComboBoxPath.Text = fi.FullPath;
 }