private void ButtonCopy_Click(object sender, RoutedEventArgs e) { List <FileItem> filesToCopy = new List <FileItem>(); foreach (FileItem f in ViewModel.ImportFiles) { if (f.Selected) { filesToCopy.Add(f); } } if (filesToCopy.Count == 0) { MessageBox.Show("No files selected for import.", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } ViewModel.GuiFrozen = true; ProgressBarWork.Value = 0; BackgroundPerformImport.progressHandler = new Progress <Tuple <float, string> >(CopyFilesStatusUpdate); Task.Run(() => BackgroundPerformImport.CopyFiles(filesToCopy)).ContinueWith(TaskDone, TaskScheduler.FromCurrentSynchronizationContext()); }
private void CommandCancelWork_Executed(object sender, System.Windows.Input.ExecutedRoutedEventArgs e) { BackgroundAnalyzeImport.Cancel(); BackgroundPerformImport.Cancel(); }