Esempio n. 1
0
        private async void RunRecoverDirectoryEntryTaskAsync(string path, DatabaseFile databaseFile)
        {
            RecoveryTask recoverTask = null;

            var numFiles = databaseFile.CountFiles();

            _taskRunner.Maximum  = numFiles;
            _taskRunner.Interval = 1;

            await _taskRunner.RunTaskAsync("Save File",
                                           (CancellationToken cancellationToken, IProgress <int> progress) =>
            {
                recoverTask = new RecoveryTask(this._volume, cancellationToken, progress);
                recoverTask.Save(path, databaseFile);
            },
                                           (int progress) =>
            {
                string currentFile = recoverTask.GetCurrentFile();
                _taskRunner.UpdateLabel($"{progress}/{numFiles}: {currentFile}");
                _taskRunner.UpdateProgress(progress);
            },
                                           () =>
            {
                Console.WriteLine("Finished saving files.");
            });
        }