Exemple #1
0
 public void DocumentComplete(object pDisp, ref object urlObject)
 {
     Debug.Assert(urlObject is null || urlObject is string, "invalid url");
     _haveNavigated = true;
     if (_parent.documentStreamToSetOnLoad != null && (string)urlObject == "about:blank")
     {
         HtmlDocument htmlDocument = _parent.Document;
         if (htmlDocument != null)
         {
             Ole32.IPersistStreamInit psi = htmlDocument.DomDocument as Ole32.IPersistStreamInit;
             Debug.Assert(psi != null, "The Document does not implement IPersistStreamInit");
             Ole32.IStream iStream = (Ole32.IStream) new Ole32.GPStream(
                 _parent.documentStreamToSetOnLoad);
             psi.Load(iStream);
             htmlDocument.Encoding = "unicode";
         }
         _parent.documentStreamToSetOnLoad = null;
     }
     else
     {
         string urlString = urlObject is null ? string.Empty : urlObject.ToString();
         WebBrowserDocumentCompletedEventArgs e = new WebBrowserDocumentCompletedEventArgs(
             new Uri(urlString));
         _parent.OnDocumentCompleted(e);
     }
 }