Move without Overwrite
Below we will describe the sequence of the move operation.
- In the case of the file, the platform opens the file handle and blocks it for reading and writing. The Engine calls IFile.OpenAsync() method.
- The platform starts the move operation. The Engine calls IFileSystemItem.MoveToAsync() method.
- The implementer calls IConfirmationResultContext.ReturnConfirmationResult() or IConfirmationResultContext.ReturnErrorResult() with error code.
- If the ReturnErrorResult() is called the platform displays an error message with Try Again and Cancel buttons. If the user cancels the operation the platform does NOT rename/move. In case of a file, the platform closes the file and the Engine calls IFile.CloseAsync(). The Engine does NOT call IFileSystemItem.MoveToCompletionAsync() and the move operation completes.
- If the ReturnConfirmationResult() is called the platform moves the item in the file system and marks it as not In-Sync.
- If the target is the offline folder, the platform lists the content of the target folder. The Engine calls IFolder.GetChildrenAsync() on the target folder.
- The Engine calls IFileSystemItem.MoveToCompletionAsync() method. Note that it is called for the item in the target path.
- In the case of the file, the Engine calls IFile.CloseAsync() method.
After the move operation completes, the file or folder is marked as not In-Sync. Depending on how you wish to implement the move operation you can
Move with Overwrite
In case the target folder exists, the platform requests confirmation from the user for the folder to overwrite. If the user confirms, the following sequence is executed:
- The platform starts the source folder deletion. The Engine calls IFileSystemItem.DeleteAsync() for the source folder.
- The platform moves each file from the source folder to the target folder. The Engine calls the sequence described in 'Move without Overwrite' section above - OpenAsync() -> MoveToAsync()-> ReturnConfirmationResult() -> MoveToCompletionAsync() -> CloseAsync() method for each file and folder.
- The platform completes the delete operation. The Engine calls IFileSystemItem.DeleteCompletionAsync().