Beispiel #1
0
        public async void SetLinkExpirationTime(long expireTime)
        {
            // User must be online to perform this operation
            if (!await IsUserOnlineAsync() || expireTime < 0)
            {
                return;
            }

            var exportNode = new ExporNodeRequestListenerAsync();

            this.ExportLink = await exportNode.ExecuteAsync(() =>
            {
                this.MegaSdk.exportNodeWithExpireTime(this.OriginalMNode, expireTime, exportNode);
            });

            if (string.IsNullOrEmpty(this.ExportLink))
            {
                OnUiThread(async() =>
                {
                    await DialogService.ShowAlertAsync(
                        ResourceService.AppMessages.GetString("AM_SetLinkExpirationTimeFailed_Title"),
                        ResourceService.AppMessages.GetString("AM_SetLinkExpirationTimeFailed"));
                });
                return;
            }
            ;

            this.IsExported = true;
        }
Beispiel #2
0
        public async Task <bool> GetLinkAsync(bool showLinkDialog = true)
        {
            // User must be online to perform this operation
            if (!await IsUserOnlineAsync())
            {
                return(false);
            }

            if (this.OriginalMNode.isExported())
            {
                this.ExportLink = this.OriginalMNode.getPublicLink(true);
            }
            else
            {
                var exportNode = new ExporNodeRequestListenerAsync();
                this.ExportLink = await exportNode.ExecuteAsync(() =>
                {
                    this.MegaSdk.exportNode(this.OriginalMNode, exportNode);
                });

                if (string.IsNullOrEmpty(this.ExportLink))
                {
                    OnUiThread(async() =>
                    {
                        await DialogService.ShowAlertAsync(
                            ResourceService.AppMessages.GetString("AM_GetLinkFailed_Title"),
                            ResourceService.AppMessages.GetString("AM_GetLinkFailed"));
                    });
                    return(false);
                }
                ;
            }

            this.IsExported = true;

            if (showLinkDialog)
            {
                OnUiThread(() => DialogService.ShowShareLink(this));
            }

            return(true);
        }