示例#1
0
 /// <summary>
 /// method for add search file
 /// </summary>
 /// <param name="file"></param>
 private void AddSearchFile(FileInfo file)
 {
     this.Dispatcher.Invoke(new Action(() =>
     {
         //this.lstSearchDir.Clear();
         //this.lstSearchFile.Clear();
         ListViewItem item = null;
         if (this.indexView == 1)
         {
             item = AddListViewListFolder <FileInfo>(file, @"pack://application:,,,/Resources/icons8-file-16.png", file.Name);
         }
         else
         {
             ViewList mydata = new ViewList();
             mydata.FillFile(file);
             item = AddFoldresListView(new DirectoryInfo(file.FullName), mydata);
         }
         this.LVInfo.Items.Add(item);
         try
         {
             this.lstSearchFile.Add((FileInfo)item.Tag);
         }
         catch (Exception ex)
         {
             DirectoryInfo dir = (DirectoryInfo)item.Tag;
             this.lstSearchFile.Add(new FileInfo(dir.FullName));
         }
         this.countElement++;
         this.lbElemet.Content = string.Format("Elements: {0}", this.countElement.ToString());
     }));
 }
示例#2
0
        public void AddFileFileListView(string newFile, FileInfo file)
        {
            ViewList mydata = new ViewList();

            mydata.FillFile(file);
            ListViewItem item = AddFoldresListView(new DirectoryInfo(file.FullName), mydata);

            this.LVInfo.Items.Add(item);
            if (newFile != null)
            {
                if (file.FullName == newFile)
                {
                    item.IsSelected = true;
                }
            }
        }