// [System.Security.Per.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name="FullTrust")] public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { // System.Windows.Forms.MessageBox.Show(null, context.Instance.GetType().FullName, "caption"); XmlConfigurationOption option = context.Instance as XmlConfigurationOption; if (option != null) { IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (edSvc != null) { TypeSelectionTypeEditorControl typeSelector = new TypeSelectionTypeEditorControl(); typeSelector.WindowsFormsEditorService = edSvc; edSvc.DropDownControl(typeSelector); try { Type t = typeSelector.SelectedType; if (t != null) { option.Value = null; option.ValueAssemblyQualifiedName = t.AssemblyQualifiedName; return(t.AssemblyQualifiedName); } // Assembly a = typeSelector.RefrencedAssembly; // if (t != null && a != null) // { // System.IO.FileInfo f = new System.IO.FileInfo(a.Location); // option.Value = null; // option.ReferencedAssemblyName = f.Name; // return t.FullName; // } } catch (System.Exception) {} return(value); } } return(base.EditValue(context, provider, value)); }
// [System.Security.Per.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name="FullTrust")] public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { // System.Windows.Forms.MessageBox.Show(null, context.Instance.GetType().FullName, "caption"); XmlConfigurationOption option = context.Instance as XmlConfigurationOption; if (option != null) { IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (edSvc != null) { TypeSelectionTypeEditorControl typeSelector = new TypeSelectionTypeEditorControl(); typeSelector.WindowsFormsEditorService = edSvc; edSvc.DropDownControl(typeSelector); try { Type t = typeSelector.SelectedType; if (t != null) { option.Value = null; option.ValueAssemblyQualifiedName = t.AssemblyQualifiedName; return t.AssemblyQualifiedName; } // Assembly a = typeSelector.RefrencedAssembly; // if (t != null && a != null) // { // System.IO.FileInfo f = new System.IO.FileInfo(a.Location); // option.Value = null; // option.ReferencedAssemblyName = f.Name; // return t.FullName; // } } catch(System.Exception) {} return value; } } return base.EditValue (context, provider, value); }