private void TBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { if (isLogout) { if (count++ == 2) { isLogout = false; TBrowser.Navigate(Uri); } return; } Uri = e.Url; if (TBrowser.Document != null) { String str = TBrowser.Document.Body.InnerHtml; //((mshtml.HTMLDocument)(((TBrowser.Document.DomDocument)))).documentElement.innerHTML; //TBrowser.Document.OpenNew(true); //TBrowser.Document.Write(str); var regex = new Regex("<code>([0-9]*)</code>", RegexOptions.Multiline | RegexOptions.CultureInvariant | RegexOptions.IgnoreCase | RegexOptions.Compiled); VerificationCode = regex.Match(str).Groups[1].Value; if (!string.IsNullOrEmpty(VerificationCode)) { this.Text = VerificationCode; btnUserThisCode.Enabled = true; } } }
private void btnLogou_Click(object sender, EventArgs e) { TBrowser.Navigate("https://twitter.com/logout"); //TBrowser.DocumentCompleted -= TBrowser_DocumentCompleted; isLogout = true; }
private void btnClearCashe_Click(object sender, EventArgs e) { System.Diagnostics.Process.Start("rundll32.exe", "InetCpl.cpl,ClearMyTracksByProcess 255"); System.Diagnostics.Process.Start("rundll32.exe", "InetCpl.cpl,ClearMyTracksByProcess 16"); System.Diagnostics.Process.Start("rundll32.exe", "InetCpl.cpl,ClearMyTracksByProcess 32"); System.Diagnostics.Process.Start("rundll32.exe", "InetCpl.cpl,ClearMyTracksByProcess 2"); System.Diagnostics.Process.Start("rundll32.exe", "InetCpl.cpl,ClearMyTracksByProcess 8"); System.Threading.Thread.Sleep(3000); TBrowser.Refresh(WebBrowserRefreshOption.Completely); TBrowser.Navigate(Uri); }