コード例 #1
0
        /// <summary>
        /// This function is called when a transfer fails by an over quota error.
        /// It does the needed actions to process this kind of error.
        /// </summary>
        /// <param name="api">MegaApi object that started the transfer</param>
        /// <param name="e">Error information</param>
        private void ProcessOverquotaError(MegaSDK api, MError e)
        {
            // TRANSFER OVERQUOTA ERROR
            if (e.getValue() != 0)
            {
                LogService.Log(MLogLevel.LOG_LEVEL_INFO,
                               string.Format("Transfer quota exceeded ({0})", e.getErrorCode().ToString()));
                AccountService.AccountDetails.IsInTransferOverquota = true;
                UiService.OnUiThread(DialogService.ShowTransferOverquotaWarning);

                return;
            }

            // STORAGE OVERQUOTA ERROR
            switch (e.getErrorCode())
            {
            case MErrorType.API_EGOINGOVERQUOTA:     // Not enough storage quota
                LogService.Log(MLogLevel.LOG_LEVEL_INFO,
                               string.Format("Not enough storage quota ({0})", e.getErrorCode().ToString()));
                UiService.OnUiThread(() => DialogService.ShowStorageOverquotaAlert(true));
                break;

            case MErrorType.API_EOVERQUOTA:     // Storage overquota error
                LogService.Log(MLogLevel.LOG_LEVEL_INFO,
                               string.Format("Storage quota exceeded ({0})", e.getErrorCode().ToString()));
                UiService.OnUiThread(() =>
                {
                    AccountService.AccountDetails.IsInStorageOverquota = true;
                    DialogService.ShowStorageOverquotaAlert(false);
                });
                break;
            }
        }
コード例 #2
0
        public override void onRequestFinish(MegaSDK api, MRequest request, MError e)
        {
            base.onRequestFinish(api, request, e);

            if (Tcs.Task.IsFaulted)
            {
                return;
            }

            if (request.getType() == MRequestType.TYPE_LOGIN)
            {
                switch (e.getErrorCode())
                {
                case MErrorType.API_OK:     // Login was successful
                    Tcs?.TrySetResult(LoginToFolderResult.Success);
                    return;

                case MErrorType.API_EARGS:
                    Tcs?.TrySetResult(DecryptionAlert ?
                                      LoginToFolderResult.InvalidDecryptionKey :         // No valid decryption key
                                      LoginToFolderResult.InvalidHandleOrDecryptionKey); // Handle length or Key length no valid
                    return;

                case MErrorType.API_EINCOMPLETE:     // Link has not decryption key
                    Tcs?.TrySetResult(LoginToFolderResult.NoDecryptionKey);
                    return;

                default:     // Unknown result, but not successful
                    Tcs?.TrySetResult(LoginToFolderResult.Unknown);
                    return;
                }
            }
        }
コード例 #3
0
        public virtual void onRequestFinish(MegaSDK api, MRequest request, MError e)
        {
            this.api = api;

            this.ErrorString = e.getErrorString();

            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                ProgressService.ChangeProgressBarBackgroundColor((Color)Application.Current.Resources["PhoneChromeColor"]);
                ProgressService.SetProgressIndicator(false);

                if (apiErrorTimer != null)
                {
                    apiErrorTimer.Stop();
                }
            });

            switch (e.getErrorCode())
            {
            case MErrorType.API_EGOINGOVERQUOTA:     // Not enough storage quota
                LogService.Log(MLogLevel.LOG_LEVEL_INFO,
                               string.Format("Not enough storage quota ({0})", e.getErrorCode().ToString()));
                UiService.OnUiThread(() => DialogService.ShowStorageOverquotaAlert(true));
                break;

            case MErrorType.API_EOVERQUOTA:     // Storage overquota error
                LogService.Log(MLogLevel.LOG_LEVEL_INFO,
                               string.Format("Storage quota exceeded ({0})", e.getErrorCode().ToString()));
                UiService.OnUiThread(() => DialogService.ShowStorageOverquotaAlert(false));
                break;
            }
        }
コード例 #4
0
        public override void onRequestFinish(MegaSDK api, MRequest request, MError e)
        {
            base.onRequestFinish(api, request, e);

            if (Tcs.Task.IsFaulted)
            {
                return;
            }

            if (request.getType() == MRequestType.TYPE_MOVE)
            {
                switch (e.getErrorCode())
                {
                case MErrorType.API_OK:     // Successfull move node process
                    if (Tcs != null)
                    {
                        Tcs.TrySetResult(true);
                    }
                    break;

                default:     // Default error processing
                    if (Tcs != null)
                    {
                        Tcs.TrySetResult(false);
                    }
                    break;
                }
            }
        }
コード例 #5
0
        public void onTransferTemporaryError(MegaSDK api, MTransfer transfer, MError e)
        {
            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                if (DebugService.DebugSettings.IsDebugMode || Debugger.IsAttached)
                {
                    if (ProgressService.GetProgressBarBackgroundColor() != (Color)Application.Current.Resources["MegaRedColor"])
                    {
                        ProgressService.ChangeProgressBarBackgroundColor((Color)Application.Current.Resources["MegaRedColor"]);
                    }
                }
            });

            switch (e.getErrorCode())
            {
            case MErrorType.API_EGOINGOVERQUOTA: // Not enough quota
            case MErrorType.API_EOVERQUOTA:      // Overquota error
                ProcessOverquotaError(api, e);
                break;
            }

            // Extra checking to avoid NullReferenceException
            if (transfer == null)
            {
                return;
            }

            // Search the corresponding transfer in the transfers list
            var megaTransfer = TransfersService.SearchTransfer(TransfersService.MegaTransfers.SelectAll(), transfer);

            if (megaTransfer == null)
            {
                return;
            }

            var isBusy           = api.areTransfersPaused((int)transfer.getType()) ? false : true;
            var transferState    = api.areTransfersPaused((int)transfer.getType()) ? MTransferState.STATE_QUEUED : transfer.getState();
            var transferPriority = transfer.getPriority();

            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                // Only update the values if they have changed to improve the UI performance
                if (megaTransfer.Transfer != transfer)
                {
                    megaTransfer.Transfer = transfer;
                }
                if (megaTransfer.IsBusy != isBusy)
                {
                    megaTransfer.IsBusy = isBusy;
                }
                if (megaTransfer.TransferState != transferState)
                {
                    megaTransfer.TransferState = transferState;
                }
                if (megaTransfer.TransferPriority != transferPriority)
                {
                    megaTransfer.TransferPriority = transferPriority;
                }
            });
        }
コード例 #6
0
        public override void onRequestFinish(MegaSDK api, MRequest request, MError e)
        {
            base.onRequestFinish(api, request, e);

            if (Tcs.Task.IsFaulted)
            {
                return;
            }

            if (request.getType() == MRequestType.TYPE_MULTI_FACTOR_AUTH_SET)
            {
                switch (e.getErrorCode())
                {
                case MErrorType.API_OK:     // Successfull set multi-factor authentication
                    if (Tcs != null)
                    {
                        Tcs.TrySetResult(true);
                    }
                    break;

                default:     // Default error processing
                    if (Tcs != null)
                    {
                        Tcs.TrySetResult(false);
                    }
                    break;
                }
            }
        }
コード例 #7
0
        public override void onRequestFinish(MegaSDK api, MRequest request, MError e)
        {
            base.onRequestFinish(api, request, e);

            if (Tcs.Task.IsFaulted)
            {
                return;
            }

            if (request.getType() == MRequestType.TYPE_GET_ATTR_USER)
            {
                switch (e.getErrorCode())
                {
                case MErrorType.API_OK:         // Successfull get user attribute process
                case MErrorType.API_ENOENT:     // Attribute not exists yet but the value still be valid
                    if (Tcs != null)
                    {
                        Tcs.TrySetResult(request.getFlag());
                    }
                    break;

                default:     // Default error processing
                    if (Tcs != null)
                    {
                        Tcs.TrySetResult(false);
                    }
                    break;
                }
            }
        }
コード例 #8
0
        public override void onRequestFinish(MegaSDK api, MRequest request, MError e)
        {
            base.onRequestFinish(api, request, e);

            if (Tcs.Task.IsFaulted)
            {
                return;
            }

            if (request.getType() == MRequestType.TYPE_INVITE_CONTACT)
            {
                switch (e.getErrorCode())
                {
                case MErrorType.API_OK:     // Successfull invite contact process
                    Tcs?.TrySetResult(InviteContactResult.Success);
                    break;

                case MErrorType.API_EACCESS:     // Remind not allowed (two week period since started or last reminder)
                    Tcs?.TrySetResult(InviteContactResult.RemindNotAllowed);
                    break;

                case MErrorType.API_EEXIST:     // Contact already exists
                    Tcs?.TrySetResult(InviteContactResult.AlreadyExists);
                    break;

                default:     // Default error processing
                    Tcs?.TrySetResult(InviteContactResult.Unknown);
                    break;
                }
            }
        }
コード例 #9
0
        public override void onRequestFinish(MegaSDK api, MRequest request, MError e)
        {
            base.onRequestFinish(api, request, e);

            if (Tcs.Task.IsFaulted)
            {
                return;
            }

            if (request.getType() == MRequestType.TYPE_CREATE_ACCOUNT)
            {
                switch (e.getErrorCode())
                {
                case MErrorType.API_OK:     // Successfull create account process
                    Tcs?.TrySetResult(CreateAccountResult.Success);
                    break;

                case MErrorType.API_EEXIST:     // Email already registered
                    Tcs?.TrySetResult(CreateAccountResult.AlreadyExists);
                    break;

                default:     // Default error processing
                    Tcs?.TrySetResult(CreateAccountResult.Unknown);
                    break;
                }
            }
        }
コード例 #10
0
        public override void onRequestFinish(MegaSDK api, MRequest request, MError e)
        {
            base.onRequestFinish(api, request, e);

            if (Tcs.Task.IsFaulted)
            {
                return;
            }

            if (request.getType() == MRequestType.TYPE_GET_ATTR_USER &&
                request.getParamType() == (int)MUserAttrType.USER_ATTR_PWD_REMINDER)
            {
                switch (e.getErrorCode())
                {
                case MErrorType.API_OK:     // Successfull get user attribute process
                    Tcs?.TrySetResult(request.getAccess() == 1);
                    break;

                case MErrorType.API_ENOENT: // User attribute is not set yet
                default:                    // Default error processing
                    Tcs?.TrySetResult(false);
                    break;
                }
            }
        }
コード例 #11
0
        public virtual void onRequestFinish(MegaSDK api, MRequest request, MError e)
        {
            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                if (apiErrorTimer != null)
                {
                    apiErrorTimer.Stop();
                }
            });

            switch (e.getErrorCode())
            {
            case MErrorType.API_EGOINGOVERQUOTA: // Not enough quota
            case MErrorType.API_EOVERQUOTA:      // Storage overquota error
                Deployment.Current.Dispatcher.BeginInvoke(DialogService.ShowOverquotaAlert);

                // Stop all upload transfers
                LogService.Log(MLogLevel.LOG_LEVEL_INFO,
                               string.Format("Storage quota exceeded ({0}) - Canceling uploads", e.getErrorCode().ToString()));
                api.cancelTransfers((int)MTransferType.TYPE_UPLOAD);

                // Disable the "Camera Uploads" service if is enabled
                if (MediaService.GetAutoCameraUploadStatus())
                {
                    LogService.Log(MLogLevel.LOG_LEVEL_INFO,
                                   string.Format("Storage quota exceeded ({0}) - Disabling CAMERA UPLOADS service", e.getErrorCode().ToString()));
                    MediaService.SetAutoCameraUpload(false);
                    SettingsService.SaveSetting(SettingsResources.CameraUploadsIsEnabled, false);
                }
                break;
            }
        }
コード例 #12
0
ファイル: App.xaml.cs プロジェクト: vrosnet/windowsphone
        public virtual void onRequestFinish(MegaSDK api, MRequest request, MError e)
        {
            switch (e.getErrorCode())
            {
            // SSL Key error management
            case MErrorType.API_EINCOMPLETE:
                if (request.getType() == MRequestType.TYPE_LOGOUT &&
                    request.getParamType() == (int)MErrorType.API_ESSL)
                {
                    if (SSLCertificateAlertDisplayed)
                    {
                        break;
                    }

                    SSLCertificateAlertDisplayed = true;
                    Deployment.Current.Dispatcher.BeginInvoke(async() =>
                    {
                        await DialogService.ShowSSLKeyErrorAlertAsync(api);
                        SSLCertificateAlertDisplayed = false;
                    });
                }
                break;

            // Bad session ID error management
            case MErrorType.API_ESID:
                AppService.LogoutActions();
                Deployment.Current.Dispatcher.BeginInvoke(() =>
                                                          NavigateService.NavigateTo(typeof(InitTourPage), NavigationParameter.API_ESID));
                break;
            }
        }
コード例 #13
0
        public override void onRequestFinish(MegaSDK api, MRequest request, MError e)
        {
            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                ProgressService.ChangeProgressBarBackgroundColor((Color)Application.Current.Resources["PhoneChromeColor"]);
                ProgressService.SetProgressIndicator(false);
            });

            switch (e.getErrorCode())
            {
            case MErrorType.API_OK:
                OnSuccesAction(api, request);
                break;

            case MErrorType.API_EEXIST:
                OnSuccesAction(api, request);
                break;

            default:
                if (ShowErrorMessage)
                {
                    Deployment.Current.Dispatcher.BeginInvoke(() =>
                    {
                        new CustomMessageDialog(
                            ErrorMessageTitle,
                            ErrorMessage,
                            App.AppInformation,
                            MessageDialogButtons.Ok).ShowDialog();
                    });
                }
                break;
            }
        }
コード例 #14
0
        public override void onRequestFinish(MegaSDK api, MRequest request, MError e)
        {
            Deployment.Current.Dispatcher.BeginInvoke(() => timerAPI_EAGAIN.Stop());

            if (e.getErrorCode() != MErrorType.API_OK)
            {
                switch (e.getErrorCode())
                {
                case MErrorType.API_ENOENT:     // E-mail unassociated with a MEGA account or Wrong password
                    Deployment.Current.Dispatcher.BeginInvoke(() =>
                                                              new CustomMessageDialog(ErrorMessageTitle, AppMessages.WrongEmailPasswordLogin,
                                                                                      App.AppInformation, MessageDialogButtons.Ok).ShowDialog());
                    return;

                case MErrorType.API_ETOOMANY:     // Too many failed login attempts
                    Deployment.Current.Dispatcher.BeginInvoke(() =>
                                                              new CustomMessageDialog(ErrorMessageTitle, AppMessages.AM_TooManyFailedLoginAttempts,
                                                                                      App.AppInformation, MessageDialogButtons.Ok).ShowDialog());
                    return;

                case MErrorType.API_EINCOMPLETE:     // Account not confirmed
                    Deployment.Current.Dispatcher.BeginInvoke(() =>
                                                              new CustomMessageDialog(ErrorMessageTitle, AppMessages.AM_AccountNotConfirmed,
                                                                                      App.AppInformation, MessageDialogButtons.Ok).ShowDialog());
                    return;

                case MErrorType.API_EBLOCKED:     // Account blocked
                    base.onRequestFinish(api, request, e);
                    return;
                }
            }

            base.onRequestFinish(api, request, e);
        }
コード例 #15
0
        public override void onRequestFinish(MegaSDK api, MRequest request, MError e)
        {
            base.onRequestFinish(api, request, e);

            if (Tcs.Task.IsFaulted)
            {
                return;
            }

            if (request.getType() == MRequestType.TYPE_QUERY_RECOVERY_LINK)
            {
                switch (e.getErrorCode())
                {
                case MErrorType.API_OK:     // Successfull change email link query
                    this.Email = request.getEmail();
                    Tcs?.TrySetResult(QueryChangeEmailLinkResult.Success);
                    return;

                case MErrorType.API_ENOENT:     // Invalid link
                    Tcs?.TrySetResult(QueryChangeEmailLinkResult.InvalidLink);
                    return;

                case MErrorType.API_EACCESS:     // No user is logged in
                    Tcs?.TrySetResult(QueryChangeEmailLinkResult.UserNotLoggedIn);
                    return;

                default:     // Unknown result, but not successful
                    Tcs?.TrySetResult(QueryChangeEmailLinkResult.Unknown);
                    return;
                }
            }
        }
コード例 #16
0
        public override void onRequestFinish(MegaSDK api, MRequest request, MError e)
        {
            base.onRequestFinish(api, request, e);

            if (Tcs.Task.IsFaulted)
            {
                return;
            }

            if (request.getType() == MRequestType.TYPE_CONFIRM_CHANGE_EMAIL_LINK)
            {
                switch (e.getErrorCode())
                {
                case MErrorType.API_OK:     // Successfull change email process
                    Tcs?.TrySetResult(ConfirmChangeEmailResult.Success);
                    return;

                case MErrorType.API_EARGS:     // User logged into an incorrect account
                    Tcs?.TrySetResult(ConfirmChangeEmailResult.WrongAccount);
                    return;

                case MErrorType.API_ENOENT:     // Wrong password
                    Tcs?.TrySetResult(ConfirmChangeEmailResult.WrongPassword);
                    return;

                case MErrorType.API_EACCESS:     // No user is logged in
                    Tcs?.TrySetResult(ConfirmChangeEmailResult.UserNotLoggedIn);
                    return;

                default:     // Unknown result, but not successful
                    Tcs?.TrySetResult(ConfirmChangeEmailResult.Unknown);
                    return;
                }
            }
        }
コード例 #17
0
        public override void onRequestFinish(MegaSDK api, MRequest request, MError e)
        {
            base.onRequestFinish(api, request, e);

            if (Tcs.Task.IsFaulted)
            {
                return;
            }

            if (request.getType() == MRequestType.TYPE_LOGOUT)
            {
                switch (e.getErrorCode())
                {
                case MErrorType.API_OK:         // Successfull log out from folder
                case MErrorType.API_ESID:       // Under certain circumstances, this request might return this error code.
                                                // It should not be taken as an error, since the reason is that the logout
                                                // action has been notified before the reception of the logout response itself.
                    Tcs?.TrySetResult(true);
                    break;

                default:     // Default error processing
                    Tcs?.TrySetResult(false);
                    break;
                }
            }
        }
コード例 #18
0
        public override void onRequestFinish(MegaSDK api, MRequest request, MError e)
        {
            base.onRequestFinish(api, request, e);

            if (Tcs.Task.IsFaulted)
            {
                return;
            }

            if (request.getType() == MRequestType.TYPE_CHANGE_PW)
            {
                switch (e.getErrorCode())
                {
                case MErrorType.API_OK:     // Successfull change password process
                    Tcs?.TrySetResult(ChangePasswordResult.Success);
                    break;

                case MErrorType.API_EFAILED:     // Wrong MFA pin.
                case MErrorType.API_EEXPIRED:    // MFA pin is being re-used and is being denied to prevent a replay attack
                    Tcs?.TrySetResult(ChangePasswordResult.MultiFactorAuthInvalidCode);
                    return;

                default:     // Default error processing
                    Tcs?.TrySetResult(ChangePasswordResult.Unknown);
                    break;
                }
            }
        }
コード例 #19
0
        public override void onRequestFinish(MegaSDK api, MRequest request, MError e)
        {
            base.onRequestFinish(api, request, e);

            if (Tcs.Task.IsFaulted)
            {
                return;
            }

            if (request.getType() == MRequestType.TYPE_LOGIN)
            {
                switch (e.getErrorCode())
                {
                case MErrorType.API_OK:     // Login was successful
                    Tcs?.TrySetResult(true);
                    return;

                case MErrorType.API_ESID:     // Bad session ID
                    Tcs?.TrySetException(new BadSessionIdException());
                    Tcs?.TrySetResult(false);
                    return;

                default:     // Unknown result, but not successful
                    Tcs?.TrySetResult(false);
                    return;
                }
            }
        }
コード例 #20
0
        public override void onRequestFinish(MegaSDK api, MRequest request, MError e)
        {
            base.onRequestFinish(api, request, e);

            if (Tcs.Task.IsFaulted)
            {
                return;
            }

            if (request.getType() == MRequestType.TYPE_CONFIRM_ACCOUNT)
            {
                switch (e.getErrorCode())
                {
                case MErrorType.API_OK:     // Valid and operative confirmation link
                    Tcs?.TrySetResult(ConfirmAccountResult.Success);
                    break;

                case MErrorType.API_ENOENT:     // Wrong password
                case MErrorType.API_EKEY:       // Wrong password
                    Tcs?.TrySetResult(ConfirmAccountResult.WrongPassword);
                    break;

                default:     // failed confirm
                    Tcs?.TrySetResult(ConfirmAccountResult.Unknown);
                    break;
                }
            }
        }
コード例 #21
0
        public virtual void onRequestFinish(MegaSDK api, MRequest request, MError e)
        {
            UiService.OnUiThread(() => apiErrorTimer?.Stop());

            switch (e.getErrorCode())
            {
            case MErrorType.API_EGOINGOVERQUOTA: // Not enough quota
            case MErrorType.API_EOVERQUOTA:      // Storage overquota error
                UiService.OnUiThread(DialogService.ShowOverquotaAlert);

                // Stop all upload transfers
                LogService.Log(MLogLevel.LOG_LEVEL_INFO,
                               string.Format("Storage quota exceeded ({0}) - Canceling uploads", e.getErrorCode().ToString()));
                api.cancelTransfers((int)MTransferType.TYPE_UPLOAD);

                // Disable the "Camera Uploads" service if is enabled
                if (TaskService.IsBackGroundTaskActive(CameraUploadService.TaskEntryPoint, CameraUploadService.TaskName))
                {
                    LogService.Log(MLogLevel.LOG_LEVEL_INFO,
                                   string.Format("Storage quota exceeded ({0}) - Disabling CAMERA UPLOADS service", e.getErrorCode().ToString()));
                    TaskService.UnregisterBackgroundTask(CameraUploadService.TaskEntryPoint, CameraUploadService.TaskName);
                }
                break;
            }
        }
コード例 #22
0
        public virtual void onRequestFinish(MegaSDK api, MRequest request, MError e)
        {
            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                ProgessService.SetProgressIndicator(false);

                //this.ControlState = true;

                if (e.getErrorCode() == MErrorType.API_OK)
                {
                    if (ShowSuccesMessage)
                    {
                        MessageBox.Show(SuccessMessage, SuccessMessageTitle, MessageBoxButton.OK);
                    }

                    if (ActionOnSucces)
                    {
                        OnSuccesAction(request);
                    }

                    if (NavigateOnSucces)
                    {
                        NavigateService.NavigateTo(NavigateToPage, NavigationParameter);
                    }
                }
                else
                {
                    MessageBox.Show(String.Format(ErrorMessage, e.getErrorString()), ErrorMessageTitle, MessageBoxButton.OK);
                }
            });
        }
コード例 #23
0
        public override void onRequestFinish(MegaSDK api, MRequest request, MError e)
        {
            base.onRequestFinish(api, request, e);

            if (Tcs.Task.IsFaulted)
            {
                return;
            }

            if (request.getType() == MRequestType.TYPE_QUERY_RECOVERY_LINK)
            {
                switch (e.getErrorCode())
                {
                case MErrorType.API_OK:     // Successful reset
                    Tcs?.TrySetResult(request.getFlag() ? RecoverLinkType.Recovery : RecoverLinkType.ParkAccount);
                    break;

                case MErrorType.API_EEXPIRED:
                    Tcs?.TrySetResult(RecoverLinkType.Expired);
                    break;

                default:     // Default error processing
                    Tcs?.TrySetResult(RecoverLinkType.Unknown);
                    break;
                }
            }
        }
コード例 #24
0
        public override void onRequestFinish(MegaSDK api, MRequest request, MError e)
        {
            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                ProgressService.ChangeProgressBarBackgroundColor((Color)Application.Current.Resources["PhoneChromeColor"]);
                ProgressService.SetProgressIndicator(false);
            });

            if (e.getErrorCode() == MErrorType.API_OK)
            {
                Deployment.Current.Dispatcher.BeginInvoke(() =>
                {
                    AccountService.AccountDetails.HasAvatarImage = true;

                    var img           = new BitmapImage();
                    img.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
                    img.UriSource     = new Uri(request.getFile());
                    AccountService.AccountDetails.AvatarUri = img.UriSource;
                });
            }
            else
            {
                Deployment.Current.Dispatcher.BeginInvoke(() =>
                {
                    AccountService.AccountDetails.HasAvatarImage = false;
                    AccountService.AccountDetails.AvatarUri      = null;
                });
            }
        }
コード例 #25
0
        public override void onRequestFinish(MegaSDK api, MRequest request, MError e)
        {
            base.onRequestFinish(api, request, e);

            if (Tcs.Task.IsFaulted)
            {
                return;
            }

            if (request.getType() == MRequestType.TYPE_MULTI_FACTOR_AUTH_CHECK)
            {
                switch (e.getErrorCode())
                {
                case MErrorType.API_OK:     // Successfull check multi-factor authentication process
                    if (Tcs != null)
                    {
                        Tcs.TrySetResult(request.getFlag() ?
                                         MultiFactorAuthStatus.Enabled :
                                         MultiFactorAuthStatus.Disabled);
                    }
                    break;

                default:     // Default error processing
                    if (Tcs != null)
                    {
                        Tcs.TrySetResult(MultiFactorAuthStatus.Unknown);
                    }
                    break;
                }
            }
        }
コード例 #26
0
 public virtual void onRequestTemporaryError(MegaSDK api, MRequest request, MError e)
 {
     if (DebugService.DebugSettings.IsDebugMode || Debugger.IsAttached)
     {
         Deployment.Current.Dispatcher.BeginInvoke(() =>
                                                   ProgressService.ChangeProgressBarBackgroundColor((Color)Application.Current.Resources["MegaRedColor"]));
     }
 }
コード例 #27
0
 public virtual void onRequestTemporaryError(MegaSDK api, MRequest request, MError e)
 {
     Deployment.Current.Dispatcher.BeginInvoke(() =>
     {
         ProgessService.SetProgressIndicator(false);
         MessageBox.Show(String.Format(ErrorMessage, e.getErrorString()), ErrorMessageTitle, MessageBoxButton.OK);
     });
 }
コード例 #28
0
        public override void onRequestFinish(MegaSDK api, MRequest request, MError e)
        {
            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                ProgressService.ChangeProgressBarBackgroundColor((Color)Application.Current.Resources["PhoneChromeColor"]);
                ProgressService.SetProgressIndicator(false);
            });

            if (e.getErrorCode() == MErrorType.API_OK)
            {
                Deployment.Current.Dispatcher.BeginInvoke(() =>
                {
                    new CustomMessageDialog(
                        SuccessMessageTitle,
                        SuccessMessage,
                        App.AppInformation,
                        MessageDialogButtons.Ok).ShowDialog();
                });

                try
                {
                    SaveUniqueReceiptId(GetUniqueReceiptId(_receipt));
                }
                catch
                {
                    // On error do nothing. The app will just retry to validate the receipt on app start and
                    // add it to the settings if succeeded or -12 (already exists) error code returns
                }
            }
            else if (e.getErrorCode() == MErrorType.API_EEXIST)
            {
                // Current receipt is already validate on MEGA license server
                // Add receipt id to the saved list in the settings
                try
                {
                    SaveUniqueReceiptId(GetUniqueReceiptId(_receipt));
                }
                catch
                {
                    // On error do nothing. The app will just retry to validate the receipt on app start and
                    // Add it to settings if succeeded or -12 (already exists) error code returns
                }
            }
            else if (e.getErrorCode() != MErrorType.API_EINCOMPLETE)
            {
                if (ShowErrorMessage)
                {
                    Deployment.Current.Dispatcher.BeginInvoke(() =>
                    {
                        new CustomMessageDialog(
                            ErrorMessageTitle,
                            String.Format(ErrorMessage, e.getErrorString()),
                            App.AppInformation,
                            MessageDialogButtons.Ok).ShowDialog();
                    });
                }
            }
        }
コード例 #29
0
            public void onRequestFinish(MegaSDK api, MRequest request, MError e)
            {
                if (RequestFinished == null)
                {
                    return;
                }

                RequestFinished(this, new SucceededEventArgs(e.getErrorCode() == MErrorType.API_OK));
            }
コード例 #30
0
        public override void onRequestFinish(MegaSDK api, MRequest request, MError e)
        {
            if (e.getErrorCode() == MErrorType.API_OK)
            {
                SessionKey = api.dumpSession();
            }

            base.onRequestFinish(api, request, e);
        }
コード例 #31
0
        public void onRequestFinish(MegaSDK api, MRequest request, MError e)
        {
            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                if (e.getErrorCode() == MErrorType.API_OK)
                {
                    _cloudDriveViewModel.CurrentRootNode = new NodeViewModel(api, api.getRootNode());
                   _cloudDriveViewModel.LoadNodes();
                }
                else
                {
                    MessageBox.Show(e.getErrorString());
                }

                ProgessService.SetProgressIndicator(false);
            });

        }
コード例 #32
0
        public virtual void onRequestFinish(MegaSDK api, MRequest request, MError e)
        {
            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                ProgessService.SetProgressIndicator(false);

                this.ControlState = true;

                if (e.getErrorCode() == MErrorType.API_OK)
                {
                    if (ShowSuccesMessage)
                        MessageBox.Show(SuccessMessage, SuccessMessageTitle, MessageBoxButton.OK);

                    if (ActionOnSucces)
                        SuccesAction.Invoke();
                    
                    if (NavigateOnSucces)
                        NavigateService.NavigateTo(NavigateToPage, NavigationParameter);
                }
                else
                    MessageBox.Show(String.Format(ErrorMessage, e.getErrorString()), ErrorMessageTitle, MessageBoxButton.OK);
            });
        }
コード例 #33
0
 public virtual void onRequestTemporaryError(MegaSDK api, MRequest request, MError e)
 {
     Deployment.Current.Dispatcher.BeginInvoke(() =>
     {
         ProgessService.SetProgressIndicator(false);
         MessageBox.Show(String.Format(ErrorMessage, e.getErrorString()), ErrorMessageTitle, MessageBoxButton.OK);
     });
 }
コード例 #34
0
 public void onRequestTemporaryError(MegaSDK api, MRequest request, MError e)
 {
     Deployment.Current.Dispatcher.BeginInvoke(() => MessageBox.Show(e.getErrorString()));
 }
コード例 #35
0
ファイル: LoginViewModel.cs プロジェクト: chsergey/sdk
        public override void onRequestFinish(MegaSDK api, MRequest request, MError e)
        {
            if (e.getErrorCode() == MErrorType.API_OK)
                SessionKey = api.dumpSession();

            base.onRequestFinish(api, request, e);
        }