private void HandleRemove(SingleFileEntry item) { var items = SelectedItems.Cast <SingleFileEntry>().ToList(); CurrentItem = null; using (new CursorHelper(this)) { foreach (var selItem in items) { var i = Duplicates.Where(x => x.FilePath == selItem.FilePath).FirstOrDefault(); Duplicates.Remove(i); GC.Collect(); System.GC.WaitForPendingFinalizers(); FileSystem.DeleteFile(i.FilePath, UIOption.AllDialogs, RecycleOption.SendToRecycleBin, UICancelOption.ThrowException); } } }
private bool CanExecuteRemove(SingleFileEntry obj) { var nonExistentItems = SelectedItems.Cast <SingleFileEntry>().ToList().Where(f => File.Exists(f.FilePath) == false).ToList(); return(Duplicates.Count > 0 && obj != null && nonExistentItems.Count() == 0); }