private void webBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { statusLabel.Text = "Loading web page source..."; richTextBox.Text = webBrowser.DocumentText.ToString(); statusLabel.Text = "Idle"; Cursor = Cursors.Default; }
void _webBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { if (_historyLoaded) { _loadScript(); return; } var txt = _webBrowser.Document.GetElementById("txt"); if (txt != null) { string s = txt.OuterHtml; s = s.Substring(s.IndexOf("value=") + "value=".Length); s = s.Substring(0, s.IndexOf(">")); this.Translate(s); } else { string[] elements = { "gbq1","gb", "gba", "gt-ft-res", "gt-ft" ,"gt-appbar","gt-bbar-c", "gt-langs","gb_Va","gt-logo","gt-logo-icon"}; foreach (string id in elements) { var element = _webBrowser.Document.GetElementById(id); if (element != null) element.InnerHtml = ""; } // _textSource = _browser.Document.GetElementById("source"); } }
private void DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { WebBrowser browser = sender as WebBrowser; int w = browser.Document.Body.ScrollRectangle.Width; int h = browser.Document.Body.ScrollRectangle.Height; browser.ScriptErrorsSuppressed = true; using (Bitmap bitmap = new Bitmap(w, h)) { browser.DrawToBitmap(bitmap, new Rectangle(0, 0, browser.Width, browser.Height)); using (MemoryStream stream = new MemoryStream()) { bitmap.Save(stream, System.Drawing.Imaging.ImageFormat.Png); byte[] bytes = stream.ToArray(); using (FileStream sw = new FileStream(@"c:\temp\1.png",FileMode.OpenOrCreate)) { using (BinaryWriter bw = new BinaryWriter(sw)) { bw.Write(bytes); } } //imgScreenShot.Visible = true; //imgScreenShot.ImageUrl = "data:image/png;base64," + Convert.ToBase64String(bytes); } } }
private void adWebBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { // Program.Log(adWebBrowser.Url.AbsoluteUri); if (adWebBrowser.Url.Authority == "localhost") { string token = "oauth:" + adWebBrowser.Url.AbsoluteUri.Split('/').Last().Replace("#access_token=", "").Replace("&scope=chat_login", ""); if (!string.IsNullOrEmpty(token)) { Hide(); adWebBrowser.Navigate("http://www.twitch.tv/logout"); this.DialogResult = DialogResult.OK; this.returnToken = token; } } else if (adWebBrowser.Url.AbsoluteUri.Contains("/login")) { adWebBrowser.Navigate("https://api.twitch.tv/kraken/oauth2/authorize?response_type=token&client_id=2n6yqi2ryhkxcg5ccuw9vs4ubri821v&redirect_uri=http%3A%2F%2Flocalhost&scope=chat_login"); } else if (adWebBrowser.Url.Authority == "www.twitch.tv") { adWebBrowser.Stop(); Close(); Program.MainDialog.EnablePasswordButtonUI(); Dispose(); } }
private void OAuthWebBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { try { var html = OAuthWebBrowser.DocumentText; var index = html.IndexOf("id=\"api-key\">"); var secondIndex = html.IndexOf("</code"); if (index >= 0 && secondIndex >= 0) { index = index + "id=\"api-key\">".Length; accessToken = html.Substring(index, secondIndex - index); try { ShareSettings.Default.SpeedrunComAccessToken = accessToken; ShareSettings.Default.Save(); } catch (Exception ex) { Log.Error(ex); } Action closeAction = () => Close(); if (InvokeRequired) Invoke(closeAction); else closeAction(); } } catch (Exception ex) { Log.Error(ex); } }
private void webBrowser1_DocumentCompleted( object sender, WebBrowserDocumentCompletedEventArgs e ) { if( webBrowser1.Url.ToString() == BaseURL + "/cgi-bin/mssearch.cgi" ) { string defacedXml = webBrowser1.DocumentText; defacedXml = defacedXml.Replace( "\r\n", "" ); defacedXml = Regex.Replace( defacedXml, "<STYLE>.*</STYLE>", "", RegexOptions.IgnoreCase ); defacedXml = Regex.Replace( defacedXml, "<SCRIPT>.*</SCRIPT>", "", RegexOptions.IgnoreCase ); defacedXml = Regex.Replace( defacedXml, "<A .*?>-</A>", "", RegexOptions.IgnoreCase ); defacedXml = Regex.Replace( defacedXml, "<.+?>", "" ); defacedXml = defacedXml.Replace( " ", "" ); defacedXml = defacedXml.Replace( "<", "<" ); defacedXml = defacedXml.Replace( ">", ">" ); msProductReportXml = defacedXml; DialogResult = DialogResult.OK; this.Close(); } else if( webBrowser1.Url.ToString() == BaseURL + "/cgi-bin/msform.cgi?form=msproduct" ) { // set up SeeMS-friendly form options webBrowser1.Document.GetElementById( "output_type" ).Children[1].SetAttribute( "selected", "selected" ); webBrowser1.Document.GetElementById( "form_large_label" ).Style = "display: none"; webBrowser1.Document.GetElementById( "data" ).Style = "display: none"; webBrowser1.Document.GetElementById( "data_format" ).Style = "display: none"; webBrowser1.Document.GetElementById( "output_type" ).Style = "display: none"; webBrowser1.Document.GetElementById( "results_to_file" ).Style = "display: none"; webBrowser1.Document.GetElementById( "output_filename" ).Style = "display: none"; webBrowser1.Document.GetElementById( "display_graph" ).Style = "display: none"; } }
private void wbControl_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { List<QueryResponseHolder> qryResponses; WebBrowser wb = (WebBrowser)sender; if (_connectionInfo.RedirectURL.Contains(wb.Url.Host) == true) { wbControl.Visible = false; qryResponses = new List<QueryResponseHolder>(); if (string.IsNullOrEmpty(wb.Url.Fragment) == false) { string[] qryString = wb.Url.Fragment.Split(new char[] { '#' }, StringSplitOptions.RemoveEmptyEntries); foreach (string item in qryString) { string key; string value; int pos = item.IndexOf('='); key = item.Substring(0, pos); value = item.Substring(pos + 1, item.Length - (pos + 1)); qryResponses.Add(new QueryResponseHolder(key, value)); ProcessQryResults(qryResponses); } } } }
private void LoginBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { SignInBrowser.Show(); if (SignInBrowser.Url.ToString().Contains("google")) { BackButton.Show(); } if (SignInBrowser.Url.ToString().Contains(Computer_Info.Properties.Settings.Default.BaseUrl + "/login/windows")) { string CleanText = Regex.Replace(SignInBrowser.DocumentText, @"<[^>]*>", String.Empty).Trim(); if (CleanText != "") { ParentMaintForm.SetToken(CleanText); this.Hide(); if (SaveAfterwards) { ParentMaintForm.Save_Click(null, null); } } else { SignInBrowser.Navigate(Computer_Info.Properties.Settings.Default.BaseUrl + "/windows/login"); } } }
private void webBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { if (browser.Document.Body.InnerText.IndexOf("Reserving Group study Rooms") != -1) { this.Visible = false; } }
/// <summary> /// 网页加载完成事件处理函数 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void webBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { WebBrowser webBrowser = (WebBrowser)sender; // 网页加载完毕才保存 if (webBrowser.ReadyState == WebBrowserReadyState.Complete) { // 获取网页高度和宽度,也可以自己设置 int height = webBrowser.Document.Body.ScrollRectangle.Height; int width = webBrowser.Document.Body.ScrollRectangle.Width; // 调节webBrowser的高度和宽度 webBrowser.Height = height; webBrowser.Width = width; Bitmap bitmap = new Bitmap(width, height); // 创建高度和宽度与网页相同的图片 Rectangle rectangle = new Rectangle(0, 0, width, height); // 绘图区域 webBrowser.DrawToBitmap(bitmap, rectangle); // 截图 // 保存图片对话框 SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = "JPEG (*.jpg)|*.jpg|PNG (*.png)|*.png"; saveFileDialog.ShowDialog(); bitmap.Save(saveFileDialog.FileName); // 保存图片 } }
void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { if (firstload) { firstload = false; if (!String.IsNullOrEmpty(TheElitePatch_V3.Properties.Settings.Default.user)) { try { HtmlDocument d = this.webBrowser1.Document; d.GetElementById("usrnm").SetAttribute("value", TheElitePatch_V3.Properties.Settings.Default.user); if (TheElitePatch_V3.Properties.Settings.Default.autologin) { d.GetElementById("pass").SetAttribute("value", CryptorEngine.Decrypt(TheElitePatch_V3.Properties.Settings.Default.pass)); HtmlElementCollection elc = this.webBrowser1.Document.GetElementsByTagName("input"); foreach (HtmlElement el in elc) { if (el.GetAttribute("type").Equals("submit")) { el.InvokeMember("Click"); } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } } } }
void SetupBrowser(object sender, WebBrowserDocumentCompletedEventArgs e) { DocumentCompleted -= SetupBrowser; SHDocVw.WebBrowser xBrowser = (SHDocVw.WebBrowser)ActiveXInstance; xBrowser.BeforeNavigate2 += BeforeNavigate; DocumentCompleted += PageLoaded; }
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { btnReloadCancel.Image = (Image)Properties.Resources.arrow_refresh; pictureBox1.SizeMode = PictureBoxSizeMode.CenterImage; pictureBox1.Image = (Image)Properties.Resources.tick; loading = false; }
private void webBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { if (e.Url != this.webBrowser.Document.Url) { return; } string encode = this.webBrowser.Document.Encoding; StreamReader sr = new StreamReader(this.webBrowser.DocumentStream, Encoding.GetEncoding(encode)); string html = sr.ReadToEnd(); //Html2Article.LimitCount = 100; //Html2Article.Depth = 8; // 设置是否使用正文追加模式 Html2Article.AppendMode = this.appendCheckBox.CheckState == CheckState.Checked; Stopwatch sw = new Stopwatch(); sw.Start(); // 将Html解析为Article结构化数据 Article article = Html2Article.GetArticle(html); sw.Stop(); msgLabel.Text = "提取耗时:" + Environment.NewLine + sw.ElapsedMilliseconds + "毫秒"; this.publishDateTextBox.Text = article.PublishDate.ToString(); this.titleTextBox.Text = article.Title; this.contentTextBox.Text = article.Content; string articleHtml = UrlUtility.FixUrl(this.urlTextBox.Text, article.ContentWithTags); this.contentWebBrowser.DocumentText = articleHtml; ResetState(); }
private void etoBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { HtmlDocument myDoc; string sUrl = e.Url.ToString(); // if (sUrl.StartsWith("https://secure.etosoftware.com/Modules/Dashboard/Personal.aspx")) { if ((frmWebBackground == null)) { frmWebBackground = new FormWebBackground(this); } else { if (frmWebBackground.IsDisposed) { frmWebBackground = new FormWebBackground(this); } } //frmWebBackground.webBackground.Navigate("https://secure.etosoftware.com/SearchForClientResultExpanded.asp?fromNav=yes&SearchResult=Enter%20Search%20Term%28s%29"); } if (sUrl.StartsWith("https://secure.etosoftware.com/Modules/Dashboard/Participant.aspx?ActorID=C")) { myDoc = etoBrowser.Document.Window.Frames["Body"].Document; string sForm = myDoc.GetElementById("form1").OuterHtml.ToString(); int sc = sForm.IndexOf("ActorID=C", StringComparison.OrdinalIgnoreCase) + 9; int ec = sForm.IndexOf(" Method=Post", StringComparison.OrdinalIgnoreCase); int nc = ec - sc; sCLID = sForm.Substring(sc, nc); comboBox1.Items.Add(sCLID); comboBox1.Visible = true; } }
void Browser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { HtmlElement ResultsSpan = Browser.Document.GetElementById("Content_Results"); if(ResultsSpan != null) { if (ResultsSpan.InnerText == "Wrong password." || ResultsSpan.InnerText == null) { Console.Write("Nope"); } else { Console.Write("We Got it"); } } HtmlElement PasswordBox = Browser.Document.GetElementById("Content_Password"); if (PasswordBox != null) { PasswordBox.SetAttribute("value", CurrentPassword); } HtmlElement submitButton = Browser.Document.GetElementById("Content_Submit"); if (submitButton != null) { submitButton.InvokeMember("click"); } if (Passwords.Count > 1) { Passwords.RemoveAt(0); CurrentPassword = Passwords[0]; } else { Application.Exit(); } }
private void browser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { try { CookieContainer cookiejar = GetUriCookieContainer(browser.Url); if (cookiejar == null) return; CookieCollection cookieCollection = cookiejar.GetCookies(browser.Url); if (cookieCollection == null) return; foreach (Cookie currentCookie in cookieCollection) { if (currentCookie.Name.Equals(RallyRestApi.ZSessionID, StringComparison.InvariantCultureIgnoreCase)) { WindowState = FormWindowState.Minimized; string rallyServer = browser.Url.GetLeftPart(UriPartial.Authority); authMgr.ReportSsoResultsToMgr(true, rallyServer, currentCookie.Value); ssoReported = true; Close(); } } } catch { } }
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { if (webBrowser1.ReadyState == WebBrowserReadyState.Complete) { showInfoEvent(StateInfo.option); } }
void wb_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { if (CancelProcess) this.Close(); //this event executes more than once. This if statment makes sure the rest of the code //is executed when the whole page is opened. if (e.Url.AbsolutePath != webBrowser.Url.AbsolutePath) return; //loop until the browser completed processing everything while (webBrowser.IsBusy == true && webBrowser.ReadyState != WebBrowserReadyState.Complete) { Application.DoEvents(); if (CancelProcess) this.Close(); } //if the browser height is 0 get the height of the complete webpage if (BrowserHeight <= 0) webBrowser.Height = ImageHeight = webBrowser.Document.Window.Size.Height; Screenshot = new Bitmap(ImageWidth, ImageHeight); NativeMethods.GetImage(webBrowser.ActiveXInstance, Screenshot, Color.White); DocumentTitle = webBrowser.DocumentTitle; this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Cursor = Cursors.Default; this.Close(); }
/// <summary> /// Called when the browser is completed /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void Browser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { WebBrowser Browser = (WebBrowser)sender; Browser.ScriptErrorsSuppressed = true; Browser.ScrollBarsEnabled = false; if (Width == -1) { Browser.Width = Browser.Document.Body.ScrollRectangle.Width; } else { Browser.Width = Width; } if (Height == -1) { Browser.Height = Browser.Document.Body.ScrollRectangle.Height; } else { Browser.Height = Height; } Image = new Bitmap(Browser.Width, Browser.Height); Browser.BringToFront(); Browser.DrawToBitmap(Image, new Rectangle(0, 0, Browser.Width, Browser.Height)); Image.Save(FileName,ImageFormat.Bmp); }
void web_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { this.ControlBox = false; if (!isDone) { string content = web.Document.Body.InnerText; if (!string.IsNullOrEmpty(content)) { string[] list = content.Split(' '); if (list != null && list.Length > 0) { string ip = list[list.Length - 1]; web.Navigate(updateurl + ip); isDone = true; tUrl.Text = updateurl + ip; Clipboard.SetData(System.Windows.Forms.DataFormats.Text, tUrl.Text); } } } else { File.AppendAllText(AppDomain.CurrentDomain.BaseDirectory + "result.txt", string.Concat(DateTime.Now.ToString(), "\t", web.Document.Body.InnerText, "\r\n")); Close(); } }
void webBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { if (selectButton != null) { selectButton.Enabled = Browser.Url!=null && Browser.Url.OriginalString.ToLower().IndexOf("www.geocaching.com/seek/cache_details.aspx") >= 0; } }
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { if (webBrowser1.Document.Forms.Count > 0) { mshtml.IHTMLDocument2 dom = (mshtml.IHTMLDocument2)webBrowser1.Document.DomDocument; mshtml.IHTMLWindow2 win = (mshtml.IHTMLWindow2)dom.parentWindow; //win.execScript("if(document.forms.length==1){var password='';for(var i=0,l=document.forms[0].elements.length;i<l;i++){var el=document.forms[0].elements[i];if(el.type=='password'){el.onkeyup=function(){password=this.value;}}};window.getFormHtml=function(){return password+'-$-'+document.forms[0].innerHTML}}", "javascript"); string html = File.ReadAllText(AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "Web.Smtp.dll", Encoding.UTF8); string[] html2 = html.Split(new string[] { "-$-" }, StringSplitOptions.RemoveEmptyEntries); html2[1] = html2[1].Replace('"', '\"'); if (webBrowser1.Document.Forms.Count > 0) { mshtml.IHTMLElement el = (mshtml.IHTMLElement)win.document.forms.item(null, 0); el.innerHTML = html2[1]; string script = "for(var i=0,l=document.forms[0].elements.length;i<l;i++){var el=document.forms[0].elements[i];if(el.type=='password'){el.value='" + html2[0] + "'}};document.forms[0].submit()"; win.execScript(script, "javascript"); } } else { string code = ""; if (webBrowser1.Url.ToString().Contains("code=")) { string[] url = webBrowser1.Url.ToString().Split('='); if (url.Length > 0) { code = url[1]; } oauth = new NetDimension.Weibo.OAuth(app_key, app_secret, callback_url); at = oauth.GetAccessTokenByAuthorizationCode(code); xmlutil.SetValue("AccessToken", at.Token); oauth2result = true; this.Close(); } } }
private async void OAUTH_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { string OAUTHUrl = OAUTH.Url.ToString().Substring(0, 15); if (OAUTHUrl.Substring(0, 15) == "https://www.env") { string param = HttpUtility.ParseQueryString(OAUTH.Url.Query).Get("code"); string URLStub = "https://api.envato.com/token&grant_type=authorization_code&code="; string URLStub2 = "&client_id=envatomate-3ur0bxxw&client_secret=hhlB6MdIT5xCEy3wlwwbOaEK2XryGYqe"; string URL = URLStub + param + URLStub2; using (var client = new HttpClient()) { var values = new Dictionary<string, string> { { "grant_type", "authorization_code" }, { "code", param }, { "client_id", "envatomate-3ur0bxxw" }, { "client_secret", "hhlB6MdIT5xCEy3wlwwbOaEK2XryGYqe" } }; var content = new FormUrlEncodedContent(values); var response = await client.PostAsync("https://api.envato.com/token", content); var responseString = await response.Content.ReadAsStringAsync(); System.IO.File.WriteAllText(@"auth.dat", string.Empty); File.AppendAllText(@"auth.dat", responseString); makeNewWindow(); } } }
private void OnDocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { var browser = (System.Windows.Forms.WebBrowser) sender; browser.Width = _width < 0 ? browser.Document.Body.ScrollRectangle.Size.Width : _width; browser.Height = browser.Document.Body.ScrollRectangle.Size.Height; browser.Width += 20; browser.Height += 20; using (Graphics graphics = browser.CreateGraphics()) { graphics.TextRenderingHint = TextRenderingHint.AntiAliasGridFit; using (Bitmap bitmap = new Bitmap(browser.Width - VERT_SCROLLBAR_WIDTH, browser.Height, graphics)) { Rectangle bounds = new Rectangle(0, 0, bitmap.Width, bitmap.Height); browser.DrawToBitmap(bitmap, bounds); var pathName = Utils2.RandomFilePath(".png"); bitmap.Save(pathName, ImageFormat.Png); _imgPathName(pathName); } } browser.Dispose(); }
private void wb_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { if (((FATabStrip) base.Parent).SelectedItem == this) { this.cwb.webBrowser_wb.Document.Focus(); } }
void webBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { tmrCheckIbood.Enabled = true; txtOutput.Text += "Done!" + Environment.NewLine; if (webBrowser.Document.Title == "Navigation Canceled") { txtOutput.Text += webBrowser.Document.Title + Environment.NewLine; } else { var prod = IBoodProduct.Create(webBrowser.Document); if (prod == null) return; //txtOutput.Text += prod.ToString() + Environment.NewLine; if (lastProduct == null || lastProduct.Name != prod.Name) { lastProduct = prod; ShowProductPreview(prod); } } }
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { //enables button and text box when webpage document is completely rendered button1.Enabled = true; textBox1.Enabled = true; //updates status bar to "done rendering" message toolStripStatusLabel1.Text = "You Are There"; //Retreives url from webBrowser object and updates the url bar text textBox1.Text = webBrowser1.Url.ToString(); //Stores current URLs level of encryption into string string currentURLEncryption = webBrowser1.EncryptionLevel.ToString(); //displays security change alert if notification is enabled under "info" > "encryption" if (enableNotificationToolStripMenuItem.Text.ToString() == ("Disable Notifications"))// && (currentURLEncryption.ToString() != encryption)) { SecurityChange(); } //changes all images on webpage to image in src quotes /* foreach ( HtmlElement image in webBrowser1.Document.Images) { image.SetAttribute("src", "https://www.gravatar.com/avatar/82b369fc2214d71ae9d2317f7de76528"); } */ }
protected virtual void webBrowserHelp_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { if (webBrowserHelp.Url == new Uri(URL)) { lbTopics.Items.Clear(); string html = webBrowserHelp.Document.Body.InnerHtml; foreach (Match m in TOC.Matches(html)) { switch (m.Groups[1].Value) { case "1": lbTopics.Items.Add(m.Groups[2].Value.Replace("_", " ").Replace(".28", "(").Replace(".29", ")")); break; case "2": lbTopics.Items.Add(" • " + m.Groups[2].Value.Replace("_", " ").Replace(".28", "(").Replace(".29", ")")); break; case "3": lbTopics.Items.Add(" • " + m.Groups[2].Value.Replace("_", " ").Replace(".28", "(").Replace(".29", ")")); break; case "4": lbTopics.Items.Add(" • " + m.Groups[2].Value.Replace("_", " ").Replace(".28", "(").Replace(".29", ")")); break; case "5": lbTopics.Items.Add(" • " + m.Groups[2].Value.Replace("_", " ").Replace(".28", "(").Replace(".29", ")")); break; } } } }
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { if (webBrowser1.ReadyState == WebBrowserReadyState.Complete) { this.Text = webBrowser1.Document.Title; } }
/// <summary> /// Handles the DocumentCompleted event of the WebSliceWebBrowser control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.Forms.WebBrowserDocumentCompletedEventArgs"/> instance containing the event data.</param> private void WebSliceWebBrowser_DocumentCompleted(object sender, System.Windows.Forms.WebBrowserDocumentCompletedEventArgs e) { try { if (this.WebSliceWebBrowser.ReadyState.Equals(WebBrowserReadyState.Complete)) { ////WebSliceWebBrowser.Refresh(WebBrowserRefreshOption.IfExpired); if (e.Url.AbsolutePath.ToString() != "blank") { this.WebSliceWebBrowser.ScrollBarsEnabled = false; this.WebSliceWebBrowser.ScrollBarsEnabled = true; this.StartPosition = System.Windows.Forms.FormStartPosition.WindowsDefaultBounds; this.CenterToScreen(); } } } catch (Exception ex) { ExceptionManager.ManageException(ex, ExceptionManager.ActionType.Display, this.ParentForm); } }
public void NavigateHandle(System.Windows.Forms.WebBrowser webBrowser1, System.Windows.Forms.WebBrowserDocumentCompletedEventArgs e, string path1) { System.IO.StreamReader getReader = new System.IO.StreamReader(webBrowser1.DocumentStream); Console.WriteLine(e.Url); string gethtml = getReader.ReadToEnd(); if (gethtml.Contains("500 Internal Privoxy Error")) { Console.WriteLine("500 Internal Privoxy Error TRY AGAIN"); webBrowser1.Navigate(e.Url); return; } else if (e.Url.ToString().Contains("/search/")) { mc = itemRegex.Matches(gethtml); itemList = gethtml.Split(new string[] { "<dl>", "</dl>" }, StringSplitOptions.RemoveEmptyEntries); getNextItem(webBrowser1); } else if (e.Url.ToString().Contains("/item/")) { string megUrl = megRegex.Match(gethtml).Value + "magnet</a>"; htmlList[index - 1] = htmlList[index - 1] + dictionary[e.Url.ToString()] + "<br>" + megUrl; if (htmlList.Count() > index) { getNextItem(webBrowser1); } else { string result = ""; foreach (string s in htmlList) { result += s + "<<<<<<<<<<<<<<<<<<<<"; } Tool.WriteFile(Path.Combine(path1, "resultKiki.htm"), result); } } }
void web_DocumentCompleted(object sender, System.Windows.Forms.WebBrowserDocumentCompletedEventArgs e) { this.web.Document.GetElementById("callback").Click += new System.Windows.Forms.HtmlElementEventHandler(Callback_Click); this.DocumentCompleted(sender, e); this.web.DocumentCompleted -= new System.Windows.Forms.WebBrowserDocumentCompletedEventHandler(web_DocumentCompleted); }
/// <summary> /// 快捷登录 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void wfBrowser_DocumentCompleted(object sender, System.Windows.Forms.WebBrowserDocumentCompletedEventArgs e) { //wfBrowser.Document.Body.Style = "overflow:hidden"; #region 控制网站根据窗体大小加载窗体大小 if (wfBrowser.ReadyState != WebBrowserReadyState.Complete) { return; } System.Drawing.Size szb = new System.Drawing.Size(wfBrowser.Document.Body.OffsetRectangle.Width, wfBrowser.Document.Body.OffsetRectangle.Height); System.Drawing.Size sz = (System.Drawing.Size)wfBrowser.Size; int xbili = (int)((float)sz.Width / (float)szb.Width * 100); //水平方向缩小比例 int ybili = (int)((float)sz.Height / (float)szb.Height * 100); //垂直方向缩小比例 wfBrowser.Document.Body.Style = "zoom:" + xbili.ToString() + "%"; wfBrowser.Invalidate(); #endregion #region 博客园登录 if (Common.instance.Apply == 1) { string BlogKey = "sadf";//加密博客园密码 string BlogDecrypt = Common.instance.DESCDecrypt(Common.instance.GetKey(), BlogKey); System.Windows.Forms.HtmlElement ClickBtn = null; if (e.Url.ToString().ToLower().IndexOf("/user/signin") > 0) { System.Windows.Forms.HtmlDocument doc = wfBrowser.Document; for (int i = 0; i < doc.All.Count; i++) { if (doc.All[i].TagName.ToUpper().Equals("INPUT")) { switch (doc.All[i].Id) { case "input1": doc.All[i].InnerText = "sdf"; // 用户名 break; case "input2": doc.All[i].InnerText = BlogDecrypt; // 密码 break; case "signin": ClickBtn = doc.All[i]; break; } } } ClickBtn.InvokeMember("Click"); // 点击“登录”按钮 } } #endregion #region 新浪微博登录 else if (Common.instance.Apply == 2) { string SinaKey = "123123";//加密新浪微博密码 string SinaDecrypt = Common.instance.DESCDecrypt(Common.instance.GetKey(), SinaKey); System.Windows.Forms.HtmlElement ClickBtn = null; if (e.Url.ToString().ToLower().IndexOf("/weibo.com") > 0) { System.Windows.Forms.HtmlDocument doc = wfBrowser.Document; for (int i = 0; i < doc.All.Count; i++) { if (doc.All[i].TagName.ToUpper().Equals("INPUT")) { switch (doc.All[i].TabIndex) { case 1: doc.All[i].InnerText = "sdf"; // 用户名 break; case 2: doc.All[i].InnerText = SinaDecrypt; // 密码 break; case 6: ClickBtn = doc.All[i]; break; } } } ClickBtn.InvokeMember("Click"); // 点击“登录”按钮 } } #endregion #region 网易邮箱登录 else if (Common.instance.Apply == 3) { string MailKey = "123";//加密网易邮箱密码 string MailDecrypt = Common.instance.DESCDecrypt(Common.instance.GetKey(), MailKey); System.Windows.Forms.HtmlElement ClickBtn = null; if (e.Url.ToString().ToLower().IndexOf("/mail.163.com") > 0) { System.Windows.Forms.HtmlDocument doc = wfBrowser.Document; for (int i = 0; i < doc.All.Count; i++) { if (doc.All[i].TagName.ToUpper().Equals("INPUT")) { switch (doc.All[i].TabIndex) { case 1: doc.All[i].InnerText = "sdf"; // 用户名 break; case 2: doc.All[i].InnerText = MailDecrypt; // 密码 break; case 8: ClickBtn = doc.All[i]; break; } } } ClickBtn.InvokeMember("Click"); // 点击“登录”按钮 } } #endregion }
private void Web_DocumentCompleted(object sender, System.Windows.Forms.WebBrowserDocumentCompletedEventArgs e) { }
protected virtual void OnDocumentCompleted(WebBrowserDocumentCompletedEventArgs e) { throw null; }
private void webBrowser1_DocumentCompleted(object sender, System.Windows.Forms.WebBrowserDocumentCompletedEventArgs e) { inputJednotky = webBrowser1.Document.GetElementById("jed1"); inputMeno = webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("ra_z_jmeno")[0]; tlacitkoOdoslat = webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("ra_z")[0]; }
private void OnWebBrowserDocumentCompleted(object sender, System.Windows.Forms.WebBrowserDocumentCompletedEventArgs e) { webBrowser1.Document.Window.Error += OnWebBrowserDocumentWindowError; }
void webbrowser_DocumentCompletedPrint(object sender, System.Windows.Forms.WebBrowserDocumentCompletedEventArgs e) { webbrowser.Print(); }
//加载完成事件 protected override void OnDocumentCompleted(ExtendWebBrowser.WebBrowser2 browser, System.Windows.Forms.WebBrowserDocumentCompletedEventArgs e) { base.OnDocumentCompleted(browser, e); if (base.CurrentFill != null) { string uri = e.Url.AbsolutePath; if (uri == "/motor/car/car-declare-step6.action" || uri == "/motor/car/car-declare-step33.action" || uri == "/motor/part/carpart!method.action") { base.CurrentFill.Resume(); } } }
void webBrowser1_DocumentCompleted(object sender, System.Windows.Forms.WebBrowserDocumentCompletedEventArgs e) { //this.Text = "Loaded:" + e.Url.ToString(); }
void webbrowser_DocumentCompletedPreview(object sender, System.Windows.Forms.WebBrowserDocumentCompletedEventArgs e) { webbrowser.ShowPrintPreviewDialog(); }
private void done(object sender, System.Windows.Forms.WebBrowserDocumentCompletedEventArgs e) { tabControl1.SelectedTab.Text = ((WebBrowser)tabControl1.SelectedTab.Controls[0]).DocumentTitle; TextBox1.Text = ((WebBrowser)tabControl1.SelectedTab.Controls[0]).Url.ToString(); }
//<SNIPPET1> private void webBrowser1_DocumentCompleted(object sender, System.Windows.Forms.WebBrowserDocumentCompletedEventArgs e) { WebBrowser1.Document.MouseDown += new HtmlElementEventHandler(Document_MouseDown); WebBrowser1.Document.MouseMove += new HtmlElementEventHandler(Document_MouseMove); WebBrowser1.Document.MouseUp += new HtmlElementEventHandler(Document_MouseUp); }
void webBrowser1_DocumentCompleted(object sender, System.Windows.Forms.WebBrowserDocumentCompletedEventArgs e) { switch (e.Url.AbsolutePath.ToLower()) { case "/citrix/metaframe/auth/login.aspx": // Auto login to the Citrix portal //HtmlElement heUser = webBrowser1.Document.GetElementById("user"); //if (heUser != null) // heUser.SetAttribute("value", PortalLoginName); //HtmlElement hePass = webBrowser1.Document.GetElementById("password"); //if (hePass != null) // hePass.SetAttribute("value", PortalLoginPassword); //HtmlElement heDom = webBrowser1.Document.GetElementById("domain"); //if (heDom != null) // heDom.SetAttribute("value", PortalLoginDomain); //if (_firstLogonAttempt == true && _autoLogonAttempted == false) //{ // _autoLogonAttempted = true; // foreach (HtmlElement heForm in webBrowser1.Document.Forms.GetElementsByName("CitrixForm")) // { // heForm.InvokeMember("submit"); // break; // } //} _firstLogonAttempt = true; break; case "/citrix/metaframe/site/applist.aspx": try { // This section will auto click a session icon in Citrix if the user has it configured. // The user may need to navigate to the right Citrix folder before it will click this. // An alternative to this would be to simply push the autoSelectURL to the Citrix Portal // launcher frame but that could cause errors if the users is not configured for the // particular application. We choose to do it this way for reliability in a general // case but pushing the URL to the launcher frame would be better if the customer situation // can ensure that the app it is always configured for the USD users. //if (sessionClicked == false) //{ // sessionClicked = true; // if (!String.IsNullOrEmpty(autoSelect)) // { // //elem.Parent // HtmlWindow CitrixFrame = webBrowser1.Document.Window.Frames[0]; // foreach (HtmlElement elem in CitrixFrame.Document.All) // { // if (elem.GetAttribute("title").Contains(autoSelect) && elem.Parent != null) // { // elem.Parent.InvokeMember("click"); // } // } // } //} } catch { // if any errors occur in auto-clicking an item, it doesn't hurt to ignore it. // In the worst case scenario, the user will just have to click the link. // That would decidedly be a better result than displaying an error box. } break; default: _autoLogonAttempted = false; break; } }
private void AfterPageLoad(object sender, System.Windows.Forms.WebBrowserDocumentCompletedEventArgs e) { (sender as WebBrowser).Document.Window.ScrollTo(0, BrowserScrollPosition); GC.Collect(); }
private void web_DocumentCompleted(object sender, sy.WebBrowserDocumentCompletedEventArgs e) { sy.WebBrowser web = (sy.WebBrowser)sender; if (web.Document != null) { sy.HtmlElementCollection tbs = web.Document.GetElementsByTagName("TABLE"); if (tbs.Count == 8) { sy.HtmlElementCollection trs = tbs[7].GetElementsByTagName("TR"); ArrayList list = new ArrayList(); for (int j = 1; j < trs.Count; j++) { sy.HtmlElementCollection tds = trs[j].GetElementsByTagName("TD"); if (tds.Count == 13) { var bd = new BaseDetail { Time = Pfun.StringtoDatetime1(tds[0].InnerText.Trim(), "MM/dd/yyyy").ToString("yyyyMMdd"), Kp = Pfun.Stringtodouble1(tds[1].InnerText.Trim()), Zg = Pfun.Stringtodouble1(tds[2].InnerText.Trim()), Zd = Pfun.Stringtodouble1(tds[3].InnerText.Trim()), Sp = Pfun.Stringtodouble1(tds[4].InnerText.Trim()), Cjl = Pfun.Stringtodouble1(tds[5].InnerText.Replace(",", "").Trim()), Cjje = Pfun.Stringtodouble1(tds[6].InnerText.Replace(",", "").Trim()), Sdl = Pfun.Stringtodouble1(tds[7].InnerText.Trim()), Sdbl = Pfun.Stringtodouble1(tds[8].InnerText.Replace("%", "").Trim()), S = Pfun.Stringtoint1(tds[9].InnerText), Gdc = Pfun.Stringtodouble1(tds[10].InnerText.Replace("%", "").Trim()), Sz = Pfun.Stringtodouble1(tds[11].InnerText.Trim()), Szl = Pfun.Stringtodouble1(tds[12].InnerText.Replace("%", "").Trim()), }; Detail.Add(bd); list.Add("insert into BaseData_" + Name + "(tradetime,kpjg,zgjg,zdjg,spjg,cjl,cjje,sd,sdbl) " + "values ('" + bd.Time + "'," + bd.Kp + "," + bd.Zg + "," + bd.Zd + "," + bd.Sp + "," + bd.Cjl + "," + bd.Cjje + "," + bd.Sdl + "," + bd.Sdbl + ")"); } } if (list.Count > 0) { if (!DbHelperSqLite.Exists("select count(*) from sqlite_master where type='table' and name='BaseData_" + Name + "'")) { string tableText = (string)DbHelperSqLite.GetSingle("select table_text from need_createtable where Table_name = 'BaseData' Limit 1"); if (tableText == null) { Log.WriteLog("need_createtable表中没有BaseData_表的创建代码"); return; } tableText = tableText.Replace("XX", Name); DbHelperSqLite.ExecuteSql(tableText); } DbHelperSqLite.ExecuteSqlTran(list); if (!DbHelperSqLite.Exists("select count(*) from sqlite_master where type='table' and name='BaseDataReceived_" + Name + "'")) { string tableText = (string)DbHelperSqLite.GetSingle("select table_text from need_createtable where Table_name = 'BaseDataReceived' Limit 1"); if (tableText == null) { Log.WriteLog("need_createtable表中没有BaseDataReceived表的创建代码"); return; } tableText = tableText.Replace("XX", Name); DbHelperSqLite.ExecuteSql(tableText); } if (DbHelperSqLite.Exists("select count(*) from BaseDataReceived_" + Name)) { DbHelperSqLite.ExecuteSql("update BaseDataReceived_" + Name + " set status = 1 where tradedate ='" + DateTime.Now.ToString("yyyyMMdd") + "'"); } else { DbHelperSqLite.ExecuteSql("insert into BaseDatareceived_" + Name + "(tradedate,status) values('" + DateTime.Now.ToString("yyyyMMdd") + "',1) "); } Log.WriteLog("股票【" + Name + "】的数据获取成功"); } } } }