Exemplo n.º 1
0
        /// <include file='doc\URLEditor.uex' path='docs/doc[@for="UrlEditor.EditValue"]/*' />
        /// <devdoc>
        ///    <para>
        ///       Edits the specified object value using
        ///       the editor style provided by GetEditorStyle.
        ///    </para>
        /// </devdoc>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (provider != null)
            {
                IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

                if (edSvc != null)
                {
                    string url     = (string)value;
                    string caption = Caption;
                    string filter  = Filter;

                    IComponent component = null;
                    if (context.Instance is IComponent)
                    {
                        component = (IComponent)context.Instance;
                    }
                    else if (context.Instance is object[])
                    {
                        object[] components = (object[])context.Instance;
                        if (components[0] is IComponent)
                        {
                            component = (IComponent)components[0];
                        }
                    }

                    url = UrlBuilder.BuildUrl(component, null, url, caption, filter, Options);
                    if (url != null)
                    {
                        value = url;
                    }
                }
            }
            return(value);
        }
Exemplo n.º 2
0
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     if ((provider != null) && (((IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService))) != null))
     {
         string initialUrl = (string)value;
         string caption    = this.Caption;
         string filter     = this.Filter;
         initialUrl = UrlBuilder.BuildUrl(provider, null, initialUrl, caption, filter, this.Options);
         if (initialUrl != null)
         {
             value = initialUrl;
         }
     }
     return(value);
 }
Exemplo n.º 3
0
 public static string BuildUrl(IComponent component, System.Windows.Forms.Control owner, string initialUrl, string caption, string filter)
 {
     return(UrlBuilder.BuildUrl(component, owner, initialUrl,
                                caption, filter, UrlBuilderOptions.None));
 }