コード例 #1
0
        private void OnError(List <TranslatableObject> e)
        {
            var errorsPopup = new RegisterErrorsViewModel();

            errorsPopup.Errors = e;
            if (_core.TryGetUiManager(out IUiManager _ui))
            {
                _ui.ShowPopup(errorsPopup, new TranslatableObject("Change credentials failed", new Translator("UserAccount")).Text, PopupType.Warning);
            }
            else
            {
                _core.Logger.Error(this, "ui manager not loaded");
            }
            return;
        }
 private async Task <bool> GetSecurityQuestionsAsync()
 {
     if (_core.TryGetUiManager(out IUiManager _ui))
     {
         return(await _ui.DoWhileBusy(async() =>
         {
             try
             {
                 var response =
                     await _core.HttpClient.GetObjectAsync <List <SecurityQuestion> >("get_security_questions/", allowCache: false);
                 if (response.Success)
                 {
                     var lst = response.Result;
                     SecurityQuestions = lst;
                     OnPropertyChanged(nameof(SecurityQuestions));
                     return true;
                 }
                 return false;
             }
             catch
             {
                 var errorsPopup = new RegisterErrorsViewModel();
                 var errors = new List <TranslatableObject>
                 {
                     new TranslatableObject("An unexpected error occured. Please try again later.", translator)
                 };
                 errorsPopup.Errors = errors;
                 await _ui.ShowPopup(errorsPopup);
                 return false;
             }
         }));
     }
     else
     {
         _core.Logger.Error(this, "ui manager not loaded");
     }
     return(false);
 }