public void Operate(bool ignoreConflicts, Action finished) { OperationRunner.Operate(() => { RunOperation(operationItems, ignoreConflicts); }, finished); }
void Rename(IService service) { var result = OperationCheckResult.ServiceNotSupported; var item = service.GetInput <NewName>(); switch (item.directory) { case "Dienste": case "drives": result = OperationCheckResult.Incompatible; break; case "Favoriten": if (!item.makeCopy) { result = OperationCheckResult.CopyToFavorites; } else { result = OperationCheckResult.AlreadyExists; } break; default: var newItem = Path.Combine(item.directory, item.newName); if (File.Exists(newItem) || Directory.Exists(newItem)) { result = OperationCheckResult.AlreadyExists; } else { var fo = new FileOperation(item.directory, item.makeCopy ? Api.FileFuncFlags.FO_COPY : Api.FileFuncFlags.FO_RENAME); OperationRunner.Operate(() => { fo.Rename(item.oldName, item.newName); }, () => { foreach (var id in item.idsToRefresh) { EventSession.Refresh(id); } }); result = OperationCheckResult.OK; } break; } service.SendResult(result); }