private void CopyFiles() { int counter = 0; try { _filenames.Clear(); OnProgressChange("Copying files"); _tempdir = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); Directory.CreateDirectory(_tempdir); foreach (FileItem fileItem in _files) { string randomFile = Path.Combine(_tempdir, "image_" + counter.ToString("0000") + ".jpg"); OnProgressChange("Copying file " + fileItem.Name); PhotoUtils.CopyPhotoScale(fileItem.FileName, randomFile, 1); _filenames.Add(randomFile); counter++; if (_shouldStop) { OnActionDone(); return; } } } catch (Exception exception) { OnProgressChange("Error copy files " + exception.Message); Log.Error("Error copy files ", exception); _shouldStop = true; } }