Exemple #1
0
        private async Task ScanAsync(string path, bool scanDrive, DriveModel drive, Computer computer)
        {
            string folderName = scanDrive ? path : Path.GetFileName(path);

            await BusyWithAsync("Scanning {0} ...".FormatWith(folderName), Task.Run(() => {
                if (scanDrive)
                {
                    Drive d = App.Scanner.Scan(path);
                    drive.Load(d);
                }
                else
                {
                    Folder parent = drive.GetDrive(path);
                    App.Scanner.ScanUpdate(path, drive);
                    drive.HasLoaded = true;
                    parent.RaiseItemChanges();
                }
                drive.IsChanged = true;
                return(true);
            }));
        }
Exemple #2
0
 private void LoadIfDrive(object item)
 {
     if (item is DriveModel)
     {
         DriveModel drive  = (DriveModel)item;
         bool       loaded = VM.BusyWith("Loading {0} ...".FormatWith(drive.Name), Task.Run(() => drive.Load()));
         if (!loaded)
         {
             MessageBox.Show(this, "You need to scan this drive first.");
         }
     }
 }