public override System.Drawing.Design.UITypeEditorEditStyle GetEditStyle(System.ComponentModel.ITypeDescriptorContext context)
        {
            IMethodSelector ts = (IMethodSelector)MathNode.GetService(typeof(IMethodSelector));

            if (ts != null)
            {
                return(ts.GetUIEditorStyle(context));
            }
            return(UITypeEditorEditStyle.None);
        }
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            if (edSvc != null)
            {
                edSvc.CloseDropDown();
                IMethodSelector ts = (IMethodSelector)MathNode.GetService(typeof(IMethodSelector));
                if (ts != null)
                {
                    UITypeEditorEditStyle style = ts.GetUIEditorStyle(context);
                    if (style == UITypeEditorEditStyle.DropDown)
                    {
                        IDataSelectionControl dropdown = ts.GetUIEditorDropdown(context, provider, value);
                        if (dropdown != null)
                        {
                            edSvc.DropDownControl((Control)dropdown);
                            object v = dropdown.UITypeEditorSelectedValue;
                            if (v != null)
                            {
                                return(v);
                            }
                        }
                    }
                    else if (style == UITypeEditorEditStyle.Modal)
                    {
                        IDataSelectionControl modal = ts.GetUIEditorModal(context, provider, value);
                        if (modal != null)
                        {
                            if (edSvc.ShowDialog((Form)modal) == DialogResult.OK)
                            {
                                IMethodNode mn = context.Instance as IMethodNode;
                                if (mn != null)
                                {
                                    mn.SetFunction(modal.UITypeEditorSelectedValue);
                                    return(mn.GetFunctionName());
                                }
                                return(modal.UITypeEditorSelectedValue);
                            }
                        }
                    }
                }
            }
            return(value);
        }