public override object GetEntity(Uri absoluteUri, string role, Type ofObjectToReturn) { if (absoluteUri == null) { throw new ArgumentNullException("absoluteUri"); } if (absoluteUri.Scheme == "http" && (ofObjectToReturn == null || ofObjectToReturn == typeof(Stream))) { try { return(GetResponse(absoluteUri)); } catch (Exception e) { if (WebProxyService.ProxyAuthenticationRequired(e)) { WebProxyState state = ps.PrepareWebProxy(this.GetProxy(), absoluteUri.AbsoluteUri, WebProxyState.DefaultCredentials, true); if (state != WebProxyState.Abort) { // try again... return(GetResponse(absoluteUri)); } } throw; } } else { return(base.GetEntity(absoluteUri, role, ofObjectToReturn)); } }
protected override object GetService(Type service) { if (service == typeof(UndoManager)){ return this.undoManager; } else if (service == typeof(SchemaCache)) { return this.model.SchemaCache; } else if (service == typeof(TreeView)) { XmlTreeView view = (XmlTreeView)GetService(typeof(XmlTreeView)); return view.TreeView; } else if (service == typeof(XmlTreeView)) { if (this.xmlTreeView1 == null) { this.xmlTreeView1 = this.CreateTreeView(); } return this.xmlTreeView1; } else if (service == typeof(XmlCache)) { if (null == this.model) { this.model = new XmlCache((IServiceProvider)this, (ISynchronizeInvoke)this); } return this.model; } else if (service == typeof(Settings)){ return this.settings; } else if (service == typeof(IIntellisenseProvider)) { if (this.ip == null) this.ip = CreateIntellisenseProvider(this.model, this); return this.ip; } else if (service == typeof(HelpProvider)) { return this.helpProvider1; } else if (service == typeof(WebProxyService)) { if (this.proxyService == null) this.proxyService = new WebProxyService((IServiceProvider)this); return this.proxyService; } else if (service == typeof(UserSettings)) { return new UserSettings(this.settings); } return base.GetService (service); }
public XmlProxyResolver(IServiceProvider site) { ps = site.GetService(typeof(WebProxyService)) as WebProxyService; }
public XmlProxyResolver(IServiceProvider site) { ps = site.GetService(typeof(WebProxyService)) as WebProxyService; Proxy = HttpWebRequest.DefaultWebProxy; }