Esempio n. 1
0
        private void BtnAddcheck_Click(object sender, RoutedEventArgs e)
        {
            ScanImportFolders frm = new ScanImportFolders();

            frm.Owner = GetTopParent();
            bool?result = frm.ShowDialog();

            if (result.HasValue && result.Value)
            {
                Scan s = (Scan)frm.SelectedScan;
                Scanner.Instance.Add(s);
                comboProvider.SelectedItem = s;
            }
        }
Esempio n. 2
0
        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.GetImportFolderList());
                List <SVR_VideoLocal> vl  = imp.SelectMany(a => RepoFactory.VideoLocal.GetByImportFolder(a))
                                            .Distinct()
                                            .ToList();
                List <ScanFile> files = new List <ScanFile>();
                foreach (SVR_VideoLocal v in vl)
                {
                    foreach (SVR_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;
            }
        }