Example #1
0
        internal static object EditValue(ITypeDescriptorContext context)
        {
            object value = null;

            if (context != null && context.PropertyDescriptor != null && context.Instance != null)
            {
                BindUITypeEditor bindTypeEditor = new BindUITypeEditor();
                value = context.PropertyDescriptor.GetValue(context.Instance);

                value = bindTypeEditor.EditValue(context, context, value);

                try
                {
                    context.PropertyDescriptor.SetValue(context.Instance, value);
                }
                catch (Exception e)
                {
                    string message = SR.GetString(SR.Error_CanNotBindProperty, context.PropertyDescriptor.Name);
                    if (!String.IsNullOrEmpty(e.Message))
                    {
                        message += "\n\n" + e.Message;
                    }
                    DesignerHelpers.ShowError(context, message);
                }
            }
            return(value);
        }
        internal static object EditValue(ITypeDescriptorContext context)
        {
            object obj2 = null;

            if (((context != null) && (context.PropertyDescriptor != null)) && (context.Instance != null))
            {
                BindUITypeEditor editor = new BindUITypeEditor();
                obj2 = context.PropertyDescriptor.GetValue(context.Instance);
                obj2 = editor.EditValue(context, context, obj2);
                try
                {
                    context.PropertyDescriptor.SetValue(context.Instance, obj2);
                }
                catch (Exception exception)
                {
                    string message = SR.GetString("Error_CanNotBindProperty", new object[] { context.PropertyDescriptor.Name });
                    if (!string.IsNullOrEmpty(exception.Message))
                    {
                        message = message + "\n\n" + exception.Message;
                    }
                    DesignerHelpers.ShowError(context, message);
                }
            }
            return(obj2);
        }
        public override object GetEditor(Type editorBaseType)
        {
            //If the converter is simple type converter and there is a simple UITypeEditor
            object editor = base.GetEditor(editorBaseType);

            if (editorBaseType == typeof(UITypeEditor) && !IsReadOnly)
            {
                object value = (PropertyOwner != null) ? GetValue(PropertyOwner) : null;
                bool   propertiesSupported = RealPropertyDescriptor.Converter.GetPropertiesSupported((PropertyOwner != null) ? new TypeDescriptorContext(ServiceProvider, RealPropertyDescriptor, PropertyOwner) : null);
                if (value is ActivityBind || (editor == null && !propertiesSupported))
                {
                    editor = new BindUITypeEditor();
                }
            }
            return(editor);
        }
 internal static object EditValue(ITypeDescriptorContext context)
 {
     object obj2 = null;
     if (((context != null) && (context.PropertyDescriptor != null)) && (context.Instance != null))
     {
         BindUITypeEditor editor = new BindUITypeEditor();
         obj2 = context.PropertyDescriptor.GetValue(context.Instance);
         obj2 = editor.EditValue(context, context, obj2);
         try
         {
             context.PropertyDescriptor.SetValue(context.Instance, obj2);
         }
         catch (Exception exception)
         {
             string message = SR.GetString("Error_CanNotBindProperty", new object[] { context.PropertyDescriptor.Name });
             if (!string.IsNullOrEmpty(exception.Message))
             {
                 message = message + "\n\n" + exception.Message;
             }
             DesignerHelpers.ShowError(context, message);
         }
     }
     return obj2;
 }
 public override object GetEditor(Type editorBaseType)
 {
     //If the converter is simple type converter and there is a simple UITypeEditor
     object editor = base.GetEditor(editorBaseType);
     if (editorBaseType == typeof(UITypeEditor) && !IsReadOnly)
     {
         object value = (PropertyOwner != null) ? GetValue(PropertyOwner) : null;
         bool propertiesSupported = RealPropertyDescriptor.Converter.GetPropertiesSupported((PropertyOwner != null) ? new TypeDescriptorContext(ServiceProvider, RealPropertyDescriptor, PropertyOwner) : null);
         if (value is ActivityBind || (editor == null && !propertiesSupported))
             editor = new BindUITypeEditor();
     }
     return editor;
 }
 private void OnBindProperty(ITypeDescriptorContext context, PropertyDescriptor descriptor, PropertyValueUIItem invokedItem)
 {
     BindUITypeEditor.EditValue(context);
 }
        internal static object EditValue(ITypeDescriptorContext context)
        {
            object value = null;
            if (context != null && context.PropertyDescriptor != null && context.Instance != null)
            {
                BindUITypeEditor bindTypeEditor = new BindUITypeEditor();
                value = context.PropertyDescriptor.GetValue(context.Instance);

                value = bindTypeEditor.EditValue(context, context, value);

                try
                {
                    context.PropertyDescriptor.SetValue(context.Instance, value);
                }
                catch (Exception e)
                {
                    string message = SR.GetString(SR.Error_CanNotBindProperty, context.PropertyDescriptor.Name);
                    if (!String.IsNullOrEmpty(e.Message))
                        message += "\n\n" + e.Message;
                    DesignerHelpers.ShowError(context, message);
                }
            }
            return value;
        }