private void Browser_OnVaildate_Success(string challenge, string key, string validate) { try { Device_Verify.Send_SMS(challenge, key, tmp_token, validate); this.challenge = challenge; this.key = key; this.validate = validate; Invoke(new Action(() => { CodeInputMask.Visible = true; browser.Visible = false; })); } catch (Exceptions.SMS_Send_Exception ex) { MessageBox.Show($"短信发送失败:{ex.Message}"); Invoke(new Action(() => { CodeInputMask.Visible = false; browser.Refresh(); })); throw ex; } }
private void button_Click(object sender, EventArgs e) { string code = Device_Verify.Verify(textBox.Text, tmp_token); Device_Verify.GetAccount(code, ref account); MessageBox.Show(var_dump(account)); }
private void Browser_OnVaildate_Success(string challenge, string key, string validate) { try { Device_Verify.Send_SMS(challenge, key, tmp_token, validate); this.challenge = challenge; this.key = key; this.validate = validate; Dispatcher.Invoke(() => { CodeInputMask.Visibility = Visibility.Visible; browser.Visibility = Visibility.Hidden; }); } catch (Exceptions.SMS_Send_Exception ex) { System.Windows.Forms.MessageBox.Show($"短信发送失败:{ex.Message}"); Dispatcher.Invoke(() => { CodeInputMask.Visibility = Visibility.Hidden; browser.Refresh(); }); throw ex; } }
/// <summary> /// 显示验证窗体 /// </summary> /// <param name="url">验证url</param> /// <param name="account">账号实例</param> /// <returns>运行结果</returns> public static DialogResult ShowValidateWindowDialog(string url, ref Account account) { GeetestBrowserWindow window = new GeetestBrowserWindow(ref account); window.browser.OnVaildate_Success += window.Browser_OnVaildate_Success; window.tmp_token = Device_Verify.Url2TmpToken(url); window.browser.StartVaildate(url); return(window.ShowDialog()); }
private void Btn_Confirm_Click(object sender, EventArgs e) { try { Device_Verify.GetAccount(Device_Verify.Verify(TB_Code.Text, tmp_token), ref account); DialogResult = DialogResult.OK; Close(); } catch (Exceptions.Verify_Exception ex) { MessageBox.Show($"验证码错误:{ex.Message}"); } catch (Exceptions.GetAccount_Exception ex) { MessageBox.Show($"获取账号信息错误:{ex.Message}"); } }
private void Btn_Resend_Click(object sender, EventArgs e) { Device_Verify.Send_SMS(challenge, key, tmp_token, validate); }
private void Browser_OnVaildate_Success(string challenge, string key, string validate) { Device_Verify.Send_SMS(challenge, key, tmp_token, validate); }