/// <summary> /// Handle document complete event /// </summary> /// <param name="sender">sender</param> /// <param name="e">event args</param> private void browserControl_DocumentComplete(object sender, BrowserDocumentEventArgs e) { // verify ready-state complete Debug.Assert(browserControl.Browser.ReadyState == tagREADYSTATE.READYSTATE_COMPLETE); // propagate event if (DownloadComplete != null) { DownloadComplete(this, EventArgs.Empty); } }
private void _browserControl_DocumentComplete(object sender, BrowserDocumentEventArgs e) { Timer timer = null; try { // unsubscribe from the event _browserControl.DocumentComplete -= new BrowserDocumentEventHandler(_browserControl_DocumentComplete); // get the document IHTMLDocument2 document = _browserControl.Document as IHTMLDocument2; // eliminate borders, scroll bars, and margins IHTMLElement element = document.body; element.style.borderStyle = "none"; IHTMLBodyElement body = element as IHTMLBodyElement; body.scroll = "no"; body.leftMargin = 0; body.rightMargin = 0; body.topMargin = 0; body.bottomMargin = 0; // set the width and height of the browser control to the correct // values for the snapshot // width specified by the caller _browserControl.Width = _htmlScreenCaptureCore.ContentWidth; if (_htmlScreenCaptureCore.MaximumHeight > 0) { _browserControl.Height = _htmlScreenCaptureCore.MaximumHeight; } else { // height of the content calculated based on this width IHTMLElement2 element2 = element as IHTMLElement2; _browserControl.Height = element2.scrollHeight; } // release UI thread to load the video thumbnail on screen // (the Tick may need to fire more than once to allow enough // time and message processing for an embedded object to // be fully initialized) timer = new Timer(); timer.Interval = WAIT_INTERVAL; timer.Tick += new EventHandler(timer_Tick); timer.Start(); } catch (Exception ex) { _htmlScreenCaptureCore.SetException(ex); CleanupAndExit(timer); } }
private void Handler(object sender, BrowserDocumentEventArgs args) { try { result = operation(browser); } catch (Exception e) { Trace.Fail(e.ToString()); } finally { Application.ExitThread(); } }
private void _explorerBrowserControl_ProgressDocumentComplete(object sender, BrowserDocumentEventArgs e) { try { // unsubscribe from the event _explorerBrowserControl.DocumentComplete -= new BrowserDocumentEventHandler(_explorerBrowserControl_ProgressDocumentComplete); // navigate to the actual target (pulse) BeginInvoke(new InvokeInUIThreadDelegate(NavigateBrowser)); } catch (Exception ex) { Trace.Fail("Unexpected exception in BrowserMiniForm.ProgressDocumentComplete: " + ex.ToString()); } }
private void explorerBrowserControl_DocumentComplete(object sender, BrowserDocumentEventArgs e) { IHTMLDocument2 document = (IHTMLDocument2)explorerBrowserControl.Document; // turn off borders (document.body as IHTMLElement).style.borderStyle = "none"; //MapActiveObject.ClearEvents(); if (_address != null) { MapActiveObject.FindLocation(_address); _address = null; } MapActiveObject.AttachToMapDocument(document); }
/// <summary> /// Handle document complete event /// </summary> /// <param name="sender">sender</param> /// <param name="e">event args</param> private void browserControl_DocumentComplete(object sender, BrowserDocumentEventArgs e) { // verify ready-state complete Debug.Assert(browserControl.Browser.ReadyState == tagREADYSTATE.READYSTATE_COMPLETE); UnHookEvents(false); // propagate event DownloadIsComplete = true; if (UrlHelper.IsUrl(browserControl.LocationURL) && IsDangerousSSLBoundaryCrossing()) { _result = new WebPageDownloaderResult(599, browserControl.LocationURL); //599 is hack placeholder, nothing official } else if (_result == null) { _result = WebPageDownloaderResult.Ok; } OnDownloadComplete(e); }
private void _explorerBrowserControl_AboutBlankDocumentComplete(object sender, BrowserDocumentEventArgs e) { try { // unsubscribe from the event _explorerBrowserControl.DocumentComplete -= new BrowserDocumentEventHandler(_explorerBrowserControl_AboutBlankDocumentComplete); // set borders to none IHTMLDocument2 document = _explorerBrowserControl.Document as IHTMLDocument2; if (document != null) { ICustomDoc customDoc = (ICustomDoc)document; customDoc.SetUIHandler(new BrowserDocHostUIHandler()); if (document.body != null && document.body.style != null) { document.body.style.borderStyle = "none"; } else { Debug.Fail("Couldn't set document body style after document completed!"); } } else { Debug.Fail("Couldn't get document after document completed!"); } } catch (Exception ex) { Trace.Fail("Unexpected exception in BrowserMiniForm.AboutBlankDocumentComplete: " + ex.ToString()); } }
/// <summary> /// Handle document complete event /// </summary> /// <param name="sender">sender</param> /// <param name="e">event args</param> private void browserControl_DocumentComplete(object sender, BrowserDocumentEventArgs e) { // verify ready-state complete Debug.Assert( browserControl.Browser.ReadyState == tagREADYSTATE.READYSTATE_COMPLETE ) ; // propagate event if ( DownloadComplete != null ) DownloadComplete( this, EventArgs.Empty ) ; }