예제 #1
0
 public async Task Show(string message)
 {
     try
     {
         SVProgressHUD.SetDefaultStyle(SVProgressHUDStyle.Custom);
         SVProgressHUD.ShowWithMaskType(SVProgressHUDMaskType.Black);
         SVProgressHUD.SetDefaultMaskType(SVProgressHUDMaskType.Black);
         SVProgressHUD.SetDefaultAnimationType(SVProgressHUDAnimationType.Flat);
         UIView.AnimationsEnabled = true;
         SVProgressHUD.SetForegroundColor(UIKit.UIColor.Black);
         SVProgressHUD.Show();
     }
     catch (Exception ex)
     {
     }
 }
예제 #2
0
        async void BtnLogin_TouchUpInsideAsync(object sender, EventArgs e)
        {
            try
            {
                txtPassword.ResignFirstResponder();
                //Validate our Username & Password.
                if (IsUserNameValid() && IsPasswordValid())
                {
                    SVProgressHUD.SetDefaultMaskType(SVProgressHUDMaskType.Black);
                    SVProgressHUD.ShowWithStatus("Checking Your Details...");

                    npcc_authentication oauth = new npcc_authentication();
                    inf_login_info      lg    = await oauth.Login(txtUsername.Text, txtPassword.Text);

                    SVProgressHUD.Dismiss();
                    SVProgressHUD.SetDefaultMaskType(SVProgressHUDMaskType.None);
                    //We have successfully authenticated a the user,
                    //Now fire our OnLoginSuccess Event.
                    if (lg.Authenticated == inf_login_result.SuccessfullyAuthenticated)
                    {
                        await SecureStorage.SetAsync("oauth_token", lg.Token);

                        //We have successfully authenticated a the user,
                        //Now fire our OnLoginSuccess Event.
                        if (OnLoginSuccess != null)
                        {
                            OnLoginSuccess(sender, new EventArgs());
                        }
                    }
                    else
                    {
                        SVProgressHUD.ShowErrorWithStatus(lg.Authenticated.ToString());
                        SVProgressHUD.DismissWithDelay(10);
                    }
                }
                else
                {
                    SVProgressHUD.ShowErrorWithStatus("Empty Username/ Password!");
                    SVProgressHUD.DismissWithDelay(10);
                }
            }
            catch (Exception ex)
            {
                npcc_services.inf_mobile_exception_managerAsync(ex.Message);
            }
        }