public object GetService(Type service) { if (service == typeof(HtmlDocument)) { HRESULT hr = _clientSite.GetContainer(out Ole32.IOleContainer iOlecontainer); if (hr.Succeeded() && iOlecontainer is Mshtml.IHTMLDocument) { _shimManager ??= new HtmlShimManager(); return(new HtmlDocument(_shimManager, iOlecontainer as Mshtml.IHTMLDocument)); } } else if (_clientSite.GetType().IsAssignableFrom(service)) { return(_clientSite); } return(null); }
public object GetService(Type service) { if (service == typeof(HtmlDocument)) { int hr = _clientSite.GetContainer(out UnsafeNativeMethods.IOleContainer iOlecontainer); if (NativeMethods.Succeeded(hr) && (iOlecontainer is Interop.Mshtml.IHTMLDocument)) { if (_shimManager == null) { _shimManager = new HtmlShimManager(); } return(new HtmlDocument(_shimManager, iOlecontainer as Interop.Mshtml.IHTMLDocument)); } } else if (_clientSite.GetType().IsAssignableFrom(service)) { return(_clientSite); } return(null); }