示例#1
0
        private async void CheckLoginState()
        {
            try
            {
                if (!_isChecking)
                {
                    return;
                }
                string js_login = "******";

                login_result = await LogintWebView.InvokeScriptAsync("eval", new string[] { js_login });

                if (login_result.Contains("成功"))
                {
                    return;
                }
                Tip.Text = login_result;
                if (_doLogin)
                {
                    if (login_result.Contains("错误") || login_result.Contains("失败") || login_result.Contains("不存在") ||
                        login_result.Contains("锁定")) //一系列错误
                    {
                        _doLogin = false;
                        if (CaptchaImg.Visibility == Visibility.Visible)
                        {
                            PrimaryButtonText = "加载验证码...";
                            LogintWebView.Navigate(new Uri(_login_url_redirect));
                            CaptchaImg_Input.Visibility = Visibility.Collapsed;
                            CaptchaImg.Visibility       = Visibility.Collapsed;
                            Logining.IsActive           = true;
                        }
                        else
                        {
                            IsPrimaryButtonEnabled = true;
                            Logining.IsActive      = false;
                        }
                    }
                }
                await Task.Delay(1000);

                CheckLoginState();
            }
            catch
            {
            }
        }
示例#2
0
 /// <summary>
 /// 对话框加载
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void LoginDialog_Loaded(object sender, RoutedEventArgs e)
 {
     //加载登录页面(登录完后跳转到主页)
     LoadLoginInfo();
     LogintWebView.Navigate(new Uri(_login_url_redirect));
 }