private void BtnAddcheck_Click(object sender, RoutedEventArgs e)
 {
     ScanImportFolders frm = new ScanImportFolders();
     frm.Owner = GetTopParent();
     bool? result = frm.ShowDialog();
     if (result.HasValue && result.Value)
     {
         this.IsEnabled = false;
         Cursor = Cursors.Wait;
         Scan s = frm.SelectedScan;
         HashSet<int> imp=new HashSet<int>(s.ImportFolderList);
         List<VideoLocal> vl=imp.SelectMany(a=>RepoFactory.VideoLocal.GetByImportFolder(a)).Distinct().ToList();
         List<ScanFile> files=new List<ScanFile>();
         foreach (VideoLocal v in vl)
         {
             foreach (VideoLocal_Place p in v.Places.Where(a => imp.Contains(a.ImportFolderID)))
             {
                 ScanFile sfile=new ScanFile();
                 sfile.Hash = v.ED2KHash;
                 sfile.FileSize = v.FileSize;
                 sfile.FullName = p.FullServerPath;
                 sfile.ScanID = s.ScanID;
                 sfile.Status = (int) ScanFileStatus.Waiting;
                 sfile.ImportFolderID = p.ImportFolderID;
                 sfile.VideoLocal_Place_ID = p.VideoLocal_Place_ID;
                 files.Add(sfile);
             }
         }
         RepoFactory.ScanFile.Save(files);
         this.IsEnabled = true;
         Scanner.Instance.Scans.Add(s);
         comboProvider.SelectedItem = s;
         Cursor = Cursors.Arrow;
     }
 }
Beispiel #2
0
 public void AddErrorScan(ScanFile file)
 {
     Application.Current.Dispatcher.Invoke(() =>
     {
         if (ActiveScan != null && ActiveScan.ScanID == file.ScanID)
             ActiveErrorFiles.Add(file);
     });
 }