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);
        }
 void RunOperation(IService service)
 {
     try
     {
         var operate = service.GetInput <Operate>();
         currentOperation.Operate(operate.ignoreConflicts, () =>
         {
             foreach (var id in operate.idsToRefresh)
             {
                 EventSession.Refresh(id);
             }
         });
         currentOperation = null;
     }
     catch (Exception)
     {
     }
     finally
     {
         service.SendResult(new object());
     }
 }