/// <include file='doc\URLBuilder.uex' path='docs/doc[@for="UrlBuilder.BuildUrl2"]/*' /> /// <devdoc> /// Launches the Url Picker to build a color. /// </devdoc> public static string BuildUrl(IComponent component, System.Windows.Forms.Control owner, string initialUrl, string caption, string filter, UrlBuilderOptions options) { string baseUrl = String.Empty; string result = null; ISite componentSite = component.Site; Debug.Assert(componentSite != null, "Component does not have a valid site."); if (componentSite == null) { Debug.Fail("Component does not have a valid site."); return(null); } // Work out the base Url. IWebFormsDocumentService wfdServices = (IWebFormsDocumentService)componentSite.GetService(typeof(IWebFormsDocumentService)); if (wfdServices != null) { baseUrl = wfdServices.DocumentUrl; } IWebFormsBuilderUIService builderService = (IWebFormsBuilderUIService)componentSite.GetService(typeof(IWebFormsBuilderUIService)); if (builderService != null) { result = builderService.BuildUrl(owner, initialUrl, baseUrl, caption, filter, options); } return(result); }
public static string BuildUrl(IServiceProvider serviceProvider, Control owner, string initialUrl, string caption, string filter, UrlBuilderOptions options) { string baseUrl = string.Empty; string str2 = null; IDesignerHost host = (IDesignerHost)serviceProvider.GetService(typeof(IDesignerHost)); if (host != null) { WebFormsRootDesigner designer = host.GetDesigner(host.RootComponent) as WebFormsRootDesigner; if (designer != null) { baseUrl = designer.DocumentUrl; } } if (baseUrl.Length == 0) { IWebFormsDocumentService service = (IWebFormsDocumentService)serviceProvider.GetService(typeof(IWebFormsDocumentService)); if (service != null) { baseUrl = service.DocumentUrl; } } IWebFormsBuilderUIService service2 = (IWebFormsBuilderUIService)serviceProvider.GetService(typeof(IWebFormsBuilderUIService)); if (service2 != null) { str2 = service2.BuildUrl(owner, initialUrl, baseUrl, caption, filter, options); } return(str2); }