private void HandleDownloadActivity() { try { mshtml.HTMLDocument domDocument = (mshtml.HTMLDocument) this._webBrowser.Document; if (domDocument == null) { return; } if (_isLoading || _isLoaded) { return; } this._isLoading = true; if (domDocument.readyState == "complete") { DomDocumentCompleteHandler(domDocument); } else { DomEventHandler handler = null; handler = new DomEventHandler(delegate { if (domDocument.readyState == "complete") { domDocument.detachEvent("onreadystatechange", handler); DomDocumentCompleteHandler(domDocument); } }); domDocument.attachEvent("onreadystatechange", handler); } } catch (Exception ex) { AppLog.LogException(ex); } }