Example #1
0
        /// <summary>
        /// Copy the node from its current location to a new folder destination
        /// </summary>
        /// <param name="newParentNode">The new destination folder</param>
        /// <returns>Result of the action</returns>
        public async Task <NodeActionResult> CopyAsync(MNode newParentNode)
        {
            // User must be online to perform this operation
            if (!await IsUserOnlineAsync())
            {
                return(NodeActionResult.NotOnline);
            }

            var copyNode = new CopyNodeRequestListenerAsync();
            var result   = await copyNode.ExecuteAsync(() =>
                                                       MegaSdk.copyNode(OriginalMNode, newParentNode, copyNode));

            return(result ? NodeActionResult.Succeeded : NodeActionResult.Failed);
        }
Example #2
0
        /// <summary>
        /// Import the node from its current location to a new folder destination
        /// </summary>
        /// <param name="newParentNode">The root node of the destination folder</param>
        /// <returns>Result of the action</returns>
        public async Task <NodeActionResult> ImportAsync(MNode newParentNode)
        {
            // User must be online to perform this operation
            if ((this.Parent?.Type != ContainerType.FolderLink) && !await IsUserOnlineAsync())
            {
                return(NodeActionResult.NotOnline);
            }

            var copyNode = new CopyNodeRequestListenerAsync();
            var result   = await copyNode.ExecuteAsync(() =>
            {
                SdkService.MegaSdk.copyNode(
                    SdkService.MegaSdkFolderLinks.authorizeNode(OriginalMNode),
                    newParentNode, copyNode);
            });

            return(result ? NodeActionResult.Succeeded : NodeActionResult.Failed);
        }