private void buttonOK_Click(object sender, EventArgs e) { /*1.��Ȩ��֤*/ /*2.���������ļ�*/ if (string.IsNullOrEmpty(textAppKey.Text)) { MessageBox.Show("AppKey����Ϊ��"); return; } if(string.IsNullOrEmpty(textAppSecret.Text)) { MessageBox.Show("AppSecret����Ϊ��"); return; } if(textAppKey.Text != appKey || textAppSecret.Text != appSecret) { accessKey = ""; accessSecret = ""; if (GetRequestToken(textAppKey.Text, textAppSecret.Text) == false) { MessageBox.Show("��ȡtoken key����"); return; } System.Diagnostics.Process.Start("http://open.t.qq.com/cgi-bin/authorize?oauth_token=" + tokenKey); } else if(accessKey =="" ||accessSecret == "") { if (GetRequestToken(textAppKey.Text, textAppSecret.Text) == false) { MessageBox.Show("��ȡtoken key����"); return; } System.Diagnostics.Process.Start("http://open.t.qq.com/cgi-bin/authorize?oauth_token=" + tokenKey); } appKey = textAppKey.Text; appSecret = textAppSecret.Text; if (accessKey == "" || accessSecret == "") { InputForm inputdlg = new InputForm(); inputdlg.ShowDialog(); if(inputdlg.Comfirm == false) { return; } OauthVerify = inputdlg.Input; if(GetAccessToken(appKey,appSecret,tokenKey,tokenSecret,OauthVerify) == false) { MessageBox.Show("��ȡacesskey����"); return; } accessKey = tokenKey; accessSecret = tokenSecret; } WriteConfig(); comfirm = true; Close(); }
private void buttonOK_Click(object sender, EventArgs e) { /*1.授权认证*/ /*2.保存配置文件*/ if (string.IsNullOrEmpty(textAppKey.Text)) { MessageBox.Show("AppKey不能为空"); return; } if (string.IsNullOrEmpty(textAppSecret.Text)) { MessageBox.Show("AppSecret不能为空"); return; } if (textAppKey.Text != appKey || textAppSecret.Text != appSecret) { accessKey = ""; accessSecret = ""; if (GetRequestToken(textAppKey.Text, textAppSecret.Text) == false) { MessageBox.Show("获取token key出错"); return; } System.Diagnostics.Process.Start("http://open.t.qq.com/cgi-bin/authorize?oauth_token=" + tokenKey); } else if (accessKey == "" || accessSecret == "") { if (GetRequestToken(textAppKey.Text, textAppSecret.Text) == false) { MessageBox.Show("获取token key出错"); return; } System.Diagnostics.Process.Start("http://open.t.qq.com/cgi-bin/authorize?oauth_token=" + tokenKey); } appKey = textAppKey.Text; appSecret = textAppSecret.Text; if (accessKey == "" || accessSecret == "") { InputForm inputdlg = new InputForm(); inputdlg.ShowDialog(); if (inputdlg.Comfirm == false) { return; } OauthVerify = inputdlg.Input; if (GetAccessToken(appKey, appSecret, tokenKey, tokenSecret, OauthVerify) == false) { MessageBox.Show("获取acesskey出错"); return; } accessKey = tokenKey; accessSecret = tokenSecret; } WriteConfig(); comfirm = true; Close(); }