public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (context != null && context.Instance != null && provider != null) { IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (edSvc != null) { TypeAttribute fa = null; if (context.PropertyDescriptor.Attributes != null) { foreach (Attribute a in context.PropertyDescriptor.Attributes) { fa = a as TypeAttribute; if (fa != null) { break; } } } if (fa != null) { EventInfo[] eifs = fa.Type.GetEvents(); if (eifs != null) { List <string> nms = new List <string>(); nms.Add(string.Empty); for (int i = 0; i < eifs.Length; i++) { if (WebClientMemberAttribute.IsClientEvent(eifs[i])) { nms.Add(eifs[i].Name); } } ValueList list = new ValueList(edSvc, nms.ToArray()); edSvc.DropDownControl(list); if (list.MadeSelection) { value = list.Selection; } } } } } return(value); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (context != null && context.Instance != null && provider != null) { IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (edSvc != null) { bool runAtWebClient = false; TypeAttribute fa = null; if (context.PropertyDescriptor.Attributes != null) { foreach (Attribute a in context.PropertyDescriptor.Attributes) { if (fa == null) { fa = a as TypeAttribute; } if (a is RunAtWebClientAttribute) { runAtWebClient = true; } } } if (fa != null) { IVplMethodSelector ims = context.Instance as IVplMethodSelector; if (ims != null) { object v = value; if (ims.SelectMethodForParam(edSvc, runAtWebClient, fa.Type, ref v)) { value = v; } } } } } return(value); }