public static object EditValue(this ComponentDesigner designer, object objectToChange, string propName) { var prop = TypeDescriptor.GetProperties(objectToChange)[propName]; var context = new EditorServiceContext(designer, prop); var editor = prop.GetEditor(typeof(UITypeEditor)) as UITypeEditor; var curVal = prop.GetValue(objectToChange); var newVal = editor?.EditValue(context, context, curVal); if (newVal != curVal) { try { prop.SetValue(objectToChange, newVal); } catch (CheckoutException) { } } return(newVal); }
public static object EditValue(ComponentDesigner designer, object objectToChange, string propName) { PropertyDescriptor prop = TypeDescriptor.GetProperties(objectToChange)[propName]; EditorServiceContext context = new EditorServiceContext(designer, prop); object obj2 = prop.GetValue(objectToChange); object obj3 = (prop.GetEditor(typeof(UITypeEditor)) as UITypeEditor).EditValue(context, context, obj2); if (obj3 != obj2) { try { prop.SetValue(objectToChange, obj3); } catch (CheckoutException) { } } return(obj3); }
public static DialogResult ShowDialog(this ComponentDesigner designer, Form dialog) { var context = new EditorServiceContext(designer); return(context.ShowDialog(dialog)); }
public static object EditValue(ComponentDesigner designer, object objectToChange, string propName) { PropertyDescriptor item = TypeDescriptor.GetProperties(objectToChange)[propName]; EditorServiceContext editorServiceContext = new EditorServiceContext(designer, item); UITypeEditor editor = item.GetEditor(typeof(UITypeEditor)) as UITypeEditor; object @value = item.GetValue(objectToChange); object obj = editor.EditValue(editorServiceContext, editorServiceContext, @value); if (obj != @value) { try { item.SetValue(objectToChange, obj); } catch (CheckoutException) { } } return obj; }
public static System.Windows.Forms.DialogResult ShowDialog(this ComponentDesigner designer, System.Windows.Forms.Form dialog) { EditorServiceContext context = new EditorServiceContext(designer); return(context.ShowDialog(dialog)); }
public void InvokeStringsDialog() { EditorServiceContext.EditValue(designer, Component, "Strings"); }
public static object EditValue(ComponentDesigner designer, object objectToChange, string propName) { PropertyDescriptor prop = TypeDescriptor.GetProperties(objectToChange)[propName]; EditorServiceContext context = new EditorServiceContext(designer, prop); UITypeEditor editor = prop.GetEditor(typeof(UITypeEditor)) as UITypeEditor; object obj2 = prop.GetValue(objectToChange); object obj3 = editor.EditValue(context, context, obj2); if (obj3 != obj2) { try { prop.SetValue(objectToChange, obj3); } catch (CheckoutException) { } } return obj3; }
public static object EditValue(ComponentDesigner designer, object objectToChange, string propName) { PropertyDescriptor prop = TypeDescriptor.GetProperties(objectToChange)[propName]; EditorServiceContext editorServiceContext = new EditorServiceContext(designer, prop); UITypeEditor uiTypeEditor = prop.GetEditor(typeof(UITypeEditor)) as UITypeEditor; object obj1 = prop.GetValue(objectToChange); object obj2 = uiTypeEditor.EditValue((ITypeDescriptorContext)editorServiceContext, (IServiceProvider)editorServiceContext, obj1); if (obj2 != obj1) { try { prop.SetValue(objectToChange, obj2); } catch (CheckoutException ex) { throw ex; } } return obj2; }