private void DeleteSelected() { if (MessageBox.Show(string.Format("Delete {0} files?", _selectedItems.Length), "Are you sure?", MessageBoxButtons.YesNo) == DialogResult.Yes) { foreach (var rawFileInfoViewModel in _selectedItems.ToArray()) { var error = rawFileInfoViewModel.DeleteFiles(); if (error == null) { RejectedFiles.Remove(rawFileInfoViewModel); } else { EventLog.Add(string.Format("Failed to delete file {0}: {1}", rawFileInfoViewModel.Path, error)); } } TotalSize = RejectedFiles.Sum(x => x.RawFileInfo.Size) / (1024 * 1024); RaisePropertyChanged("TotalSize"); } }
private void UpdateProgress(object sender, EventArgs e) { if (!IsSearching) { return; } RaisePropertyChanged("ProcessedFileCount"); RaisePropertyChanged("TotalSize"); if (!string.IsNullOrEmpty(_currentFile)) { CurrentDir = Path.GetDirectoryName(_currentFile); } foreach (var rejectedFile in _rejectedFiles) { if (!_rejectedFilesSet.Contains(rejectedFile)) { _rejectedFilesSet.Add(rejectedFile); RejectedFiles.Add(new RawFileInfoViewModel(rejectedFile)); } } }
private void StartSearch() { RejectedFiles.Clear(); _searchCancellationTokenSource = new CancellationTokenSource(); Task.Factory.StartNew(SearchImpl, _searchCancellationTokenSource.Token); }