Пример #1
0
 public void onRequestStart(MegaSDK api, MRequest request)
 {
     Deployment.Current.Dispatcher.BeginInvoke(() => ProgessService.SetProgressIndicator(true,
         String.Format("Fetching files & folders...[{0}/{1}]",
         request.getTransferredBytes().ToStringAndSuffix(),
         request.getTotalBytes().ToStringAndSuffix())));
 }
Пример #2
0
 public virtual void onRequestStart(MegaSDK api, MRequest request)
 {
     Deployment.Current.Dispatcher.BeginInvoke(() =>
     {
         this.ControlState = false;
         ProgessService.SetProgressIndicator(true, ProgressMessage);
     });
 }
Пример #3
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);
            });

        }
Пример #4
0
        public virtual void onRequestFinish(MegaSDK api, MRequest request, MError e)
        {
            if (e.getErrorCode() == MErrorType.API_ESID || e.getErrorCode() == MErrorType.API_ESSL)
            {
                AppService.LogoutActions();

                // Show the init tour / login page with the corresponding navigation parameter
                if (e.getErrorCode() == MErrorType.API_ESID)
                {
                    Deployment.Current.Dispatcher.BeginInvoke(() =>
                                                              NavigateService.NavigateTo(typeof(InitTourPage), NavigationParameter.API_ESID));
                }
                else if (e.getErrorCode() == MErrorType.API_ESSL)
                {
                    Deployment.Current.Dispatcher.BeginInvoke(() =>
                                                              NavigateService.NavigateTo(typeof(InitTourPage), NavigationParameter.API_ESSL));
                }
            }
        }
Пример #5
0
        public List <UserInfoEntities> DeleteAccount(MRequest request)
        {
            UserInfoEntities        users    = null;
            List <UserInfoEntities> accounts = new List <UserInfoEntities>();

            try
            {
                using (var conn = DALHelper.GetConnection())
                    using (var cmd = conn.CreateCommand())
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.CommandText = DBConstants.UserManagement.Delete_Account;

                        cmd.Parameters.AddWithValue("@Hospital", request.User.Hospital);
                        cmd.Parameters.AddWithValue("@UserId", request.User.UserId);
                        conn.Open();

                        // UserId = Convert.ToInt32(cmd.ExecuteScalar());
                        SqlDataReader dr = cmd.ExecuteReader();
                        if (dr.HasRows)
                        {
                            while (dr.Read())
                            {
                                users              = new UserInfoEntities();
                                users.UserId       = Convert.ToInt32(dr["UserId"]);
                                users.UserName     = Convert.ToString(dr["UserName"]);
                                users.Password     = Convert.ToString(dr["UserPassword"]);
                                users.MobileNumber = Convert.ToString(dr["MobileNumber"]);
                                users.Email        = Convert.ToString(dr["Email"]);
                                users.Hospital     = Convert.ToString(dr["Hospital"]);
                                accounts.Add(users);
                            }
                        }
                        conn.Close();
                    }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(accounts);
        }
Пример #6
0
        }       //	findSalesRep

        /**
         *  Find SalesRep/User based on Request Type and Question.
         *  @param request request
         *  @return SalesRep_ID user
         */
        private int FindSalesRep(MRequest request)
        {
            String QText = request.GetSummary();

            if (QText == null)
            {
                QText = "";
            }
            else
            {
                QText = QText.ToUpper();
            }
            //
            MRequestProcessorRoute[] routes = m_model.GetRoutes(false);
            for (int i = 0; i < routes.Length; i++)
            {
                MRequestProcessorRoute route = routes[i];

                //	Match first on Request Type
                if ((request.GetR_RequestType_ID() == route.GetR_RequestType_ID()) &&
                    (route.GetR_RequestType_ID() != 0))
                {
                    return(route.GetAD_User_ID());
                }

                //	Match on element of keyword
                String keyword = route.GetKeyword();
                if (keyword != null)
                {
                    StringTokenizer st = new StringTokenizer(keyword.ToUpper(), " ,;\t\n\r\f");
                    while (st.HasMoreElements())
                    {
                        if (QText.IndexOf(st.NextToken()) != -1)
                        {
                            return(route.GetAD_User_ID());
                        }
                    }
                }
            }   //	for all routes

            return(m_model.GetSupervisor_ID());
        }   //  findSalesRep
        protected override void OnSuccesAction(MegaSDK api, MRequest request)
        {
            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                var webBrowserTask = new WebBrowserTask();

                switch (_paymentMethodType)
                {
                case MPaymentMethod.PAYMENT_METHOD_CENTILI:
                    webBrowserTask.Uri = new Uri("https://www.centili.com/widget/WidgetModule?api=9e8eee856f4c048821954052a8d734ac&clientid=" + request.getLink());
                    break;

                case MPaymentMethod.PAYMENT_METHOD_FORTUMO:
                    webBrowserTask.Uri = new Uri("http://fortumo.com/mobile_payments/f250460ec5d97fd27e361afaa366db0f?cuid=" + request.getLink());
                    break;
                }

                webBrowserTask.Show();
            });
        }
        private void FetchNodesCameraUploadsPage(MegaSDK api, MRequest request)
        {
            App.AppInformation.HasFetchedNodes = true;

            var cameraUploadsRootNode = _cameraUploadsPageViewModel.CameraUploads.FolderRootNode ??
                                        NodeService.CreateNew(api, _cameraUploadsPageViewModel.AppInformation,
                                                              NodeService.FindCameraUploadNode(api, api.getRootNode()), ContainerType.CloudDrive);

            var autoResetEvent = new AutoResetEvent(false);

            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                _cameraUploadsPageViewModel.CameraUploads.FolderRootNode = cameraUploadsRootNode;
                autoResetEvent.Set();
            });
            autoResetEvent.WaitOne();

            Deployment.Current.Dispatcher.BeginInvoke(() =>
                                                      _cameraUploadsPageViewModel.LoadFolders());
        }
Пример #9
0
        /**
         *  Get Requests of Type
         *	@param selfService self service
         *	@param C_BPartner_ID id or 0 for public
         *	@return array of requests
         */
        public MRequest[] GetRequests(Boolean selfService, int C_BPartner_ID)
        {
            String sql = "SELECT * FROM R_Request WHERE R_RequestType_ID=" + GetR_RequestType_ID();

            if (selfService)
            {
                sql += " AND IsSelfService='Y'";
            }
            if (C_BPartner_ID == 0)
            {
                sql += " AND ConfidentialType='A'";
            }
            else
            {
                sql += " AND (ConfidentialType='A' OR C_BPartner_ID=" + C_BPartner_ID + ")";
            }
            sql += " ORDER BY DocumentNo DESC";
            //
            List <MRequest> list = new List <MRequest>();
            DataSet         ds;

            try
            {
                ds = new DataSet();
                ds = DataBase.DB.ExecuteDataset(sql, null, null);
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    list.Add(new MRequest(GetCtx(), dr, null));
                }
                ds = null;
            }
            catch (Exception e)
            {
                log.Log(Level.SEVERE, sql, e);
            }
            finally { ds = null; }

            MRequest[] retValue = new MRequest[list.Count];
            retValue = list.ToArray();
            return(retValue);
        }
Пример #10
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 folder link is well structured
            if (e.getErrorCode() == MErrorType.API_OK)
            {
                OnSuccesAction(api, request);
            }
            else
            {
                // Set the empty state and disable the app bar buttons
                Deployment.Current.Dispatcher.BeginInvoke(() =>
                {
                    _folderLinkViewModel.FolderLink.SetEmptyContentTemplate(false);
                    _folderLinkViewModel._folderLinkPage.SetApplicationBarData(false);
                });

                switch (e.getErrorCode())
                {
                case MErrorType.API_EARGS:
                    if (_decryptionAlert)
                    {
                        ShowDecryptionKeyNotValidAlert(api, request);     //If the user have written the key
                    }
                    else
                    {
                        ShowFolderLinkNoValidAlert();     //Handle length or Key length no valid
                    }
                    break;

                case MErrorType.API_EINCOMPLETE:     //Link has not decryption key
                    ShowDecryptionAlert(api, request);
                    break;
                }
            }
        }
Пример #11
0
        private void FetchNodesFolderLink(MegaSDK api, MRequest request)
        {
            App.LinkInformation.HasFetchedNodesFolderLink = true;

            var folderLinkRootNode = _folderLinkViewModel.FolderLink.FolderRootNode ??
                                     NodeService.CreateNew(api, App.AppInformation, api.getRootNode(), ContainerType.FolderLink);

            // Save the handle of the last public node accessed (Task #10800)
            SettingsService.SaveLastPublicNodeHandle(folderLinkRootNode.Handle);

            var autoResetEvent = new AutoResetEvent(false);

            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                _folderLinkViewModel.FolderLink.FolderRootNode = folderLinkRootNode;
                autoResetEvent.Set();
            });
            autoResetEvent.WaitOne();

            Deployment.Current.Dispatcher.BeginInvoke(() =>
                                                      _folderLinkViewModel.LoadFolders());
        }
        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 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;
            }
        }
Пример #13
0
        public override void onRequestUpdate(MegaSDK api, MRequest request)
        {
            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                ProgressService.ChangeProgressBarBackgroundColor((Color)Application.Current.Resources["PhoneChromeColor"]);
                ProgressService.SetProgressIndicator(true, String.Format(ProgressMessages.FetchingNodes,
                                                                         request.getTransferredBytes().ToStringAndSuffix(2)));
            });

            if (AppMemoryController.IsThresholdExceeded(75UL.FromMBToBytes()))
            {
                Deployment.Current.Dispatcher.BeginInvoke(() =>
                {
                    new CustomMessageDialog(
                        AppMessages.MemoryLimitError_Title,
                        AppMessages.MemoryLimitError,
                        App.AppInformation,
                        MessageDialogButtons.Ok).ShowDialog();
                    Application.Current.Terminate();
                });
            }
        }
Пример #14
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 (apiErrorTimer != null)
                {
                    apiErrorTimer.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;
                }
            }

            base.onRequestFinish(api, request, e);
        }
Пример #15
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)
            {
                if (request.getType() == MRequestType.TYPE_GET_ATTR_USER)
                {
                    switch (request.getParamType())
                    {
                    case (int)MUserAttrType.USER_ATTR_FIRSTNAME:
                        Deployment.Current.Dispatcher.BeginInvoke(() =>
                                                                  AccountService.AccountDetails.Firstname = request.getText());
                        break;

                    case (int)MUserAttrType.USER_ATTR_LASTNAME:
                        Deployment.Current.Dispatcher.BeginInvoke(() =>
                                                                  AccountService.AccountDetails.Lastname = request.getText());
                        break;
                    }
                }
            }
            else
            {
                if (request.getType() == MRequestType.TYPE_GET_ATTR_USER)
                {
                    if (request.getParamType() == (int)MUserAttrType.USER_ATTR_FIRSTNAME)
                    {
                        Deployment.Current.Dispatcher.BeginInvoke(() =>
                                                                  AccountService.AccountDetails.Firstname = UiResources.MyAccount);
                    }
                }
            }
        }
Пример #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_MULTI_FACTOR_AUTH_GET)
            {
                switch (e.getErrorCode())
                {
                case MErrorType.API_OK:     // Successfull get multi-factor authentication code process
                    Tcs?.TrySetResult(request.getText());
                    break;

                default:     // Default error processing
                    Tcs?.TrySetResult(null);
                    break;
                }
            }
        }
Пример #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_ACCOUNT_DETAILS)
            {
                switch (e.getErrorCode())
                {
                case MErrorType.API_OK:     // Successfull get account details process
                    Tcs?.TrySetResult(request.getMAccountDetails());
                    break;

                default:     // Default error processing
                    Tcs?.TrySetResult(null);
                    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_CLEAN_RUBBISH_BIN)
            {
                switch (e.getErrorCode())
                {
                case MErrorType.API_OK:     // Successfull clean rubbish bin process
                    Tcs?.TrySetResult(true);
                    break;

                default:     // Default error processing
                    Tcs?.TrySetResult(false);
                    break;
                }
            }
        }
        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_PAYMENT_METHODS)
            {
                switch (e.getErrorCode())
                {
                case MErrorType.API_OK:     // Successfull get payment methods process
                    Tcs?.TrySetResult(request.getNumber());
                    break;

                default:     // Default error processing
                    Tcs?.TrySetResult(0);
                    break;
                }
            }
        }
Пример #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_GET_RECOVERY_LINK)
            {
                switch (e.getErrorCode())
                {
                case MErrorType.API_OK:     // Successful reset
                    Tcs?.TrySetResult(true);
                    break;

                default:     // Default error processing
                    Tcs?.TrySetResult(false);
                    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 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;
            }
        }
Пример #22
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_PAUSE_TRANSFERS)
            {
                switch (e.getErrorCode())
                {
                case MErrorType.API_OK:
                    Tcs?.TrySetResult(true);
                    break;

                default:
                    Tcs?.TrySetResult(false);
                    break;
                }
            }
        }
Пример #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_GET_USER_DATA)
            {
                switch (e.getErrorCode())
                {
                case MErrorType.API_OK:     // Successful get user avatar process
                    Tcs?.TrySetResult(null);
                    break;

                default:     // Default error processing
                    Tcs?.TrySetResult(null);
                    break;
                }
            }
        }
Пример #24
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_CANCEL_TRANSFER)
            {
                switch (e.getErrorCode())
                {
                case MErrorType.API_OK:     // Successfull cancel transfer process
                    Tcs?.TrySetResult(true);
                    break;

                default:     // Default error processing
                    Tcs?.TrySetResult(false);
                    break;
                }
            }
        }
Пример #25
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);
            });
        }
Пример #26
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_SIGNUP_LINK)
            {
                switch (e.getErrorCode())
                {
                case MErrorType.API_OK:     // Valid and operative confirmation link.
                    this.EmailAddress = request.getEmail();
                    Tcs?.TrySetResult(request.getFlag() ?
                                      SignUpLinkType.AutoConfirmed : SignUpLinkType.Valid);
                    break;

                case MErrorType.API_EEXPIRED:     // Expired confirmation link.
                    Tcs?.TrySetResult(SignUpLinkType.Expired);
                    break;

                case MErrorType.API_ENOENT:     // Already confirmed account
                    Tcs?.TrySetResult(SignUpLinkType.AlreadyConfirmed);
                    break;

                case MErrorType.API_EINCOMPLETE:     // Incomplete confirmation link
                    Tcs?.TrySetResult(SignUpLinkType.Invalid);
                    break;

                default:     // Default error processing
                    Tcs?.TrySetResult(SignUpLinkType.Unknown);
                    break;
                }
            }
        }
        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
                    if (Tcs != null)
                    {
                        Tcs.TrySetResult(true);
                    }
                    return;

                case MErrorType.API_ESID:     // Bad session ID
                    if (Tcs != null)
                    {
                        Tcs.TrySetException(new BadSessionIdException());
                        Tcs.TrySetResult(false);
                    }
                    return;

                default:     // Unknown result, but not successful
                    if (Tcs != null)
                    {
                        Tcs.TrySetResult(false);
                    }
                    return;
                }
            }
        }
Пример #28
0
        public override void onRequestFinish(MegaSDK api, MRequest request, MError e)
        {
            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                if (timerAPI_EAGAIN != null)
                {
                    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;
                }
            }

            base.onRequestFinish(api, request, e);
        }
        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
                    if (Tcs != null)
                    {
                        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
                    if (Tcs != null)
                    {
                        Tcs.TrySetResult(ChangePasswordResult.MultiFactorAuthInvalidCode);
                    }
                    return;

                default:     // Default error processing
                    if (Tcs != null)
                    {
                        Tcs.TrySetResult(ChangePasswordResult.Unknown);
                    }
                    break;
                }
            }
        }
        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(() =>
                {
                    _userData.HasAvatarImage = true;

                    var img             = new BitmapImage();
                    img.CreateOptions   = BitmapCreateOptions.IgnoreImageCache;
                    img.UriSource       = new Uri(request.getFile());
                    _userData.AvatarUri = img.UriSource;
                });
            }
            else
            {
                Deployment.Current.Dispatcher.BeginInvoke(() =>
                {
                    _userData.HasAvatarImage = false;
                    _userData.AvatarUri      = null;
                });
            }

            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                if (App.UserData != null)
                {
                    App.UserData.AvatarUri = _userData.AvatarUri;
                }
            });
        }
Пример #31
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_CHANGE_EMAIL_LINK)
            {
                switch (e.getErrorCode())
                {
                case MErrorType.API_OK:     // Successfull get change email link process
                    Tcs?.TrySetResult(ChangeEmailResult.Success);
                    return;

                case MErrorType.API_EEXIST:     // Change email already requested
                    Tcs?.TrySetResult(ChangeEmailResult.AlreadyRequested);
                    return;

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

                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(ChangeEmailResult.MultiFactorAuthInvalidCode);
                    return;

                default:     // Unknown result, but not successful
                    Tcs?.TrySetResult(ChangeEmailResult.Unknown);
                    return;
                }
            }
        }
Пример #32
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_AVATAR)
            {
                switch (e.getErrorCode())
                {
                case MErrorType.API_OK:     // Successfull get user avatar process
                    Tcs?.TrySetResult(true);
                    break;

                default:     // Default error processing
                    Tcs?.TrySetResult(false);
                    break;
                }
            }
        }
Пример #33
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_RECOVERY_LINK)
            {
                switch (e.getErrorCode())
                {
                case MErrorType.API_OK:     // Successful reset
                    this.EmailAddress = request.getEmail();
                    Tcs?.TrySetResult(true);
                    return;

                default:     // failed reset
                    Tcs?.TrySetResult(false);
                    return;
                }
            }
        }
        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
                    Tcs?.TrySetResult(request.getFlag());
                    break;

                default:     // Default error processing
                    Tcs?.TrySetResult(false);
                    break;
                }
            }
        }
Пример #35
0
 public void onRequestTemporaryError(MegaSDK api, MRequest request, MError e)
 {
     Deployment.Current.Dispatcher.BeginInvoke(() => MessageBox.Show(e.getErrorString()));
 }
Пример #36
0
 protected virtual void OnSuccesAction(MRequest request)
 {
     // No standard succes action
 }
Пример #37
0
 protected override void OnSuccesAction(MRequest request)
 {
     SettingsService.ClearMegaLoginData();
     App.CloudDrive.ChildNodes.Clear();            
 }        
Пример #38
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);
     });
 }
Пример #39
0
 public virtual void onRequestUpdate(MegaSDK api, MRequest request)
 {
     // No update status necessary
 }
Пример #40
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);
        }