示例#1
0
        private void OnEditSharedEditors(object sender, EventArgs e)
        {
            PropertyDescriptor propdef = TypeDescriptor.GetProperties(Control)["RowTemplateList"];

            if (propdef == null)
            {
                return;
            }

            UITypeEditor           editor          = (UITypeEditor)propdef.GetEditor(typeof(UITypeEditor));
            RuntimeServiceProvider serviceProvider =
                new RuntimeServiceProvider(this.Control, this.Component, propdef);

            editor.EditValue(serviceProvider, serviceProvider, propdef.GetValue(this.Control));
        }
示例#2
0
        public static object EditValue(this ComponentDesigner designer, object objectToChange, string propName)
        {
            PropertyDescriptor   prop    = TypeDescriptor.GetProperties(objectToChange)[propName];
            EditorServiceContext context = new EditorServiceContext(designer, prop);
            var    editor = prop.GetEditor(typeof(System.Drawing.Design.UITypeEditor)) as System.Drawing.Design.UITypeEditor;
            object curVal = prop.GetValue(objectToChange);
            object newVal = editor.EditValue(context, context, curVal);

            if (newVal != curVal)
            {
                try { prop.SetValue(objectToChange, newVal); }
                catch (CheckoutException) { }
            }
            return(newVal);
        }
示例#3
0
        public void EnsureUITypeEditorForProperty(Type type, string propertyName, Type expectedEditorType)
        {
            PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(type);

            Assert.NotNull(properties);
            Assert.NotEmpty(properties);

            PropertyDescriptor propertyDescriptor = properties.Find(propertyName, true);

            Assert.NotNull(propertyDescriptor);

            var editor = propertyDescriptor.GetEditor(typeof(UITypeEditor));

            Assert.NotNull(editor);
            Assert.Equal(expectedEditorType, editor.GetType());
        }
示例#4
0
 public static void EditValue(IWin32Window owner, object component, string propertyName)
 {
     PropertyDescriptor prop = TypeDescriptor.GetProperties(component)[propertyName];
     if (prop == null) throw new ArgumentException("propertyName");
     UITypeEditor editor = (UITypeEditor)prop.GetEditor(typeof(UITypeEditor));
     MyHelper ctx = new MyHelper(owner, component, prop);
     if (editor != null && editor.GetEditStyle(ctx) == UITypeEditorEditStyle.Modal)
     {
         object value = prop.GetValue(component);
         value = editor.EditValue(ctx, ctx, value);
         if (!prop.IsReadOnly)
         {
             prop.SetValue(component, value);
         }
     }
 }
示例#5
0
        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);
        }
 private UITypeEditor GetEditor()
 {
     if (PropertyDescriptor != null)
     {
         try // can happen, because we are missing some editors
         {
             if (PropertyDescriptor != null)
             {
                 return((UITypeEditor)PropertyDescriptor.GetEditor(typeof(UITypeEditor)));
             }
         }
         catch
         {
             // property_grid.ShowError ("Unable to load UITypeEditor for property '" + PropertyDescriptor.Name + "'.");
         }
     }
     return(null);
 }
        /// <summary>
        /// Determines if the descriptor represents an automatic design collection property.
        /// </summary>
        public static bool IsAutoDesignCollectionProperty(this PropertyDescriptor descriptor)
        {
            var editor    = descriptor.GetEditor(typeof(UITypeEditor));
            var converter = descriptor.Converter;

            // Descriptor must be using a Collection<T>
            var supportedCollectionType = descriptor.IsPropertyTypeGeneric(typeof(Collection <>));
            // Descriptor must be using a derivative of Extensibility.DesignCollectionEditor editor,
            // or default collection editor, NOT declare an arbitrary one or a derivative of default collection editor
            var supportedEditor = ((editor is NuPattern.ComponentModel.Design.DesignCollectionEditor) ||
                                   (editor != null && editor.GetType() == typeof(System.ComponentModel.Design.CollectionEditor)));
            // Descriptor must be using a derivative of Extensibility.DesignCollectionConverter,
            // or default collection converter, NOT declare an arbitrary one or a derivative of default collection converter
            var supportedConverter = ((converter != null && converter.GetType() == typeof(System.ComponentModel.CollectionConverter)) ||
                                      (converter is DesignCollectionConverter));

            return(supportedCollectionType && supportedEditor && supportedConverter);
        }
示例#8
0
        /// <summary>
        /// Factory method for creating the appropriate drop-down control based on the given property descriptor.
        /// If the property descriptor supports a UITypeEditor, a TypeEditorHost will be created with that editor.
        /// If not, and the TypeConverver attached to the PropertyDescriptor supports standard values, a
        /// TypeEditorHostListBox will be created with this TypeConverter.
        /// </summary>
        /// <param name="propertyDescriptor">A property descriptor describing the property being set</param>
        /// <param name="instance">The object instance being edited</param>
        /// <param name="editControlStyle">The type of control to show in the edit area.</param>
        /// <returns>A TypeEditorHost instance if the given property descriptor supports it, null otherwise.</returns>
        public static new TypeEditorHost Create(PropertyDescriptor propertyDescriptor, object instance, TypeEditorHostEditControlStyle editControlStyle)
        {
            TypeEditorHost host = null;

            if (propertyDescriptor != null)
            {
                UITypeEditor editor = propertyDescriptor.GetEditor(typeof(UITypeEditor)) as UITypeEditor;
                if (editor != null)
                {
                    return(new OnScreenTypeEditorHost(editor, propertyDescriptor, instance, editControlStyle));
                }
                TypeConverter typeConverter = propertyDescriptor.Converter;
                if ((typeConverter != null) && typeConverter.GetStandardValuesSupported(null))
                {
                    host = new OnScreenTypeEditorHostListBox(typeConverter, propertyDescriptor, instance, editControlStyle);
                }
            }
            return(host);
        }
        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);
        }
示例#10
0
        public static object EditValue(ComponentDesigner designer, object objectToChange, string propName)
        {
            PropertyDescriptor   property             = TypeDescriptor.GetProperties(objectToChange)[propName];
            EditorServiceContext editorServiceContext = new EditorServiceContext(designer, property);
            UITypeEditor         editor = property.GetEditor(typeof(UITypeEditor)) as UITypeEditor;
            object obj1 = property.GetValue(objectToChange);
            object obj2 = editor.EditValue((ITypeDescriptorContext)editorServiceContext, (IServiceProvider)editorServiceContext, obj1);

            if (obj2 != obj1)
            {
                try
                {
                    property.SetValue(objectToChange, obj2);
                }
                catch (CheckoutException ex)
                {
                }
            }
            return(obj2);
        }
示例#11
0
        public InspectorEditorCell GetEditor(PropertyDescriptor pd)
        {
            InspectorEditorCell cell = pd.GetEditor(typeof(InspectorEditorCell)) as InspectorEditorCell;

            if (cell != null)
            {
                return(cell);
            }

            Type editorType = GetEditorType(pd);

            if (editorType == null)
            {
                return(Default);
            }

            if (typeof(IInspectorEditor).IsAssignableFrom(editorType))
            {
                if (!typeof(Gtk.Widget).IsAssignableFrom(editorType))
                {
                    throw new Exception("The property editor '" + editorType + "' must be a Gtk Widget");
                }
                return(Default);
            }

            cell = cellCache [editorType] as InspectorEditorCell;
            if (cell != null)
            {
                return(cell);
            }

            if (!typeof(InspectorEditorCell).IsAssignableFrom(editorType))
            {
                throw new Exception("The property editor '" + editorType + "' must be a subclass of " +
                                    "Stetic.InspectorEditorCell or implement Stetic.IInspectorEditor");
            }

            cell = (InspectorEditorCell)Activator.CreateInstance(editorType);
            cellCache [editorType] = cell;
            return(cell);
        }
        /// <summary>
        /// </summary>
        /// <param name="designer"></param>
        /// <param name="objectToChange"></param>
        /// <param name="propName"></param>
        /// <returns></returns>
        public static object EditValue(ComponentDesigner designer, object objectToChange, string propName)
        {
            PropertyDescriptor descriptor = TypeDescriptor.GetProperties(objectToChange)[propName];
            NuGenCollectionEditorServiceContext context = new NuGenCollectionEditorServiceContext(designer, descriptor);
            UITypeEditor editor   = descriptor.GetEditor(typeof(UITypeEditor)) as UITypeEditor;
            object       oldValue = descriptor.GetValue(objectToChange);
            object       newValue = editor.EditValue(context, context, oldValue);

            if (newValue != oldValue)
            {
                try
                {
                    descriptor.SetValue(objectToChange, newValue);
                }
                catch (CheckoutException)
                {
                }
            }

            return(newValue);
        }
示例#13
0
        /// <summary>
        /// Gets a UI type editor for the given property descriptor and context</summary>
        /// <param name="descriptor">Property descriptor</param>
        /// <param name="context">Type descriptor context</param>
        /// <returns>UI type editor for the given property descriptor and context</returns>
        public static UITypeEditor GetUITypeEditor(
            PropertyDescriptor descriptor,
            ITypeDescriptorContext context)
        {
            UITypeEditor editor = descriptor.GetEditor(typeof(UITypeEditor)) as UITypeEditor;

            if (editor == null)
            {
                if (StandardValuesUIEditor.CanCreateStandardValues(descriptor, context))
                {
                    editor = new StandardValuesUIEditor(descriptor);
                }
                else
                {
                    Type type = descriptor.PropertyType;
                    editor = TypeDescriptor.GetEditor(type, typeof(UITypeEditor)) as UITypeEditor;
                }
            }

            return(editor);
        }
示例#14
0
        private void button3_Click(object sender, EventArgs e)
        {
            //listBox1 is the object containing the collection.  Remember, if the collection
            //belongs to the class you're editing, you can use this
            //Items is the name of the property that is the collection you wish to edit.
            PropertyDescriptor     pd              = TypeDescriptor.GetProperties(settings)["Remotes"];
            UITypeEditor           editor          = (UITypeEditor)pd.GetEditor(typeof(UITypeEditor));
            RuntimeServiceProvider serviceProvider = new RuntimeServiceProvider();

            editor.EditValue(serviceProvider, serviceProvider, settings.Remotes);
            settings.Remotes.WriteXML(settings.PhonebookFilename);
            comboBox1.Items.Clear();
            foreach (Remote remote in settings.Remotes)
            {
                comboBox1.Items.Add(remote.Name);
            }
            if (comboBox1.Items.Count > 0)
            {
                comboBox1.SelectedIndex = 0;
            }
        }
示例#15
0
        /// <summary>
        ///     Factory method for creating the appropriate drop-down control based on the given property descriptor.  Always
        ///     creates a TypeEditorHost with the TypeEditorHostEditControlStyle.Editable style.
        /// </summary>
        /// <param name="propertyDescriptor">
        ///     Property descriptor used to create the drop-down.  If the property descriptor supports a UITypeEditor,
        ///     that will be used first.  Otherwise, the type converter will be used.
        /// </param>
        /// <param name="instance">Instance of the object being edited.</param>
        /// <returns>A DropDownControl instance if the given property descriptor supports it, null otherwise.</returns>
        internal static TypeEditorHost CreateTypeEditorHost(PropertyDescriptor propertyDescriptor, object instance)
        {
            TypeEditorHost dropDown = null;

            if (propertyDescriptor != null)
            {
                var uiTypeEditor = propertyDescriptor.GetEditor(typeof(UITypeEditor)) as UITypeEditor;
                if (uiTypeEditor != null) // UITypeEditor case
                {
                    dropDown = new TreeGridDesignerInPlaceEditDropDown(uiTypeEditor, propertyDescriptor, instance);
                }
                else
                {
                    var converter = propertyDescriptor.Converter;
                    if (converter != null &&
                        converter.GetStandardValuesSupported(null))    // converter case
                    {
                        dropDown = new TreeGridDesignerInPlaceEditCombo(converter, propertyDescriptor, instance);
                    }
                }
            }

            return(dropDown);
        }
        public static bool EditValue(IWin32Window owner, object component, string propertyName)
        {
            PropertyDescriptor prop = TypeDescriptor.GetProperties(component)[propertyName];

            if (prop == null)
            {
                throw new ArgumentException("PropertyName [" + propertyName + "] in object not found.");
            }
            UITypeEditor     editor = (UITypeEditor)prop.GetEditor(typeof(UITypeEditor));
            CollectionEditor ctx    = new CollectionEditor(owner, component, prop);

            if (editor != null && editor.GetEditStyle(ctx) == UITypeEditorEditStyle.Modal)
            {
                object value = prop.GetValue(component);
                value = editor.EditValue(ctx, ctx, value);
                if (!prop.IsReadOnly)
                {
                    prop.SetValue(component, value);
                    return(true);
                }
            }

            return(false);
        }
 public override object GetEditor(Type editorBaseType)
 {
     return(_parent.GetEditor(editorBaseType));
 }
示例#18
0
 public override object GetEditor(Type editorBaseType)
 {
     return(descriptor.GetEditor(editorBaseType));
 }
示例#19
0
 public override object GetEditor(Type editorBaseType)
 {
     return(prop.GetEditor(editorBaseType));
 }
 public override object GetEditor(Type editorBaseType)
 {
     return(_reflectedPropDescriptor.GetEditor(editorBaseType));
 }
示例#21
0
        internal static Control CreateEditorControl(PropertyDescriptor descriptor)
        {
            if (descriptor == null)
            {
                throw new ArgumentNullException("descriptor");
            }

            var    propertyType = descriptor.PropertyType;
            object editor       = null;

            try
            {
                editor = descriptor.GetEditor(typeof(IEditorPartField));
            }
            catch (Exception e)
            {
                Logger.WriteException(e);
            }

            var propName = descriptor.Name;

            if (editor != null)
            {
                var partField = editor as IEditorPartField;
                if (partField != null)
                {
                    partField.Options = GetEditorOptionsAttribute(descriptor.Attributes);
                    partField.TitleContainerCssClass = "sn-iu-label";
                    partField.TitleCssClass          = "sn-iu-title";
                    partField.DescriptionCssClass    = "sn-iu-desc";
                    partField.ControlWrapperCssClass = "sn-iu-control";
                    partField.Title              = GetDisplayName(descriptor);
                    partField.Description        = GetDescription(descriptor);
                    partField.EditorPartCssClass = "sn-inputunit ui-helper-clearfix sn-custom-editorpart-text sn-editorpart-" + propName;
                    partField.PropertyName       = propName;

                    if (propertyType == typeof(bool))
                    {
                        partField.EditorPartCssClass = "sn-inputunit ui-helper-clearfix sn-custom-editorpart-boolean sn-editorpart-" + propName;
                    }
                    if (typeof(Enum).IsAssignableFrom(propertyType))
                    {
                        // TODO: fill the instance of the EditorPart control with datas. Best solution is extend the IEditorPartField interface with Fill method
                    }
                    var result = partField as Control;
                    result.ID = "Custom" + propName;
                    return(result);
                }
            }

            if (propertyType == typeof(bool))
            {
                var checkBox = new CheckBoxEditorPartField();
                checkBox.ID                     = "CheckBox" + propName;
                checkBox.Options                = GetEditorOptionsAttribute(descriptor.Attributes);
                checkBox.EditorPartCssClass     = "sn-inputunit ui-helper-clearfix sn-custom-editorpart-boolean sn-editorpart-" + propName;
                checkBox.Title                  = GetDisplayName(descriptor);
                checkBox.Description            = GetDescription(descriptor);
                checkBox.TitleContainerCssClass = "sn-iu-label";
                checkBox.TitleCssClass          = "sn-iu-title";
                checkBox.DescriptionCssClass    = "sn-iu-desc";
                checkBox.ControlWrapperCssClass = "sn-iu-control";
                checkBox.PropertyName           = propName;

                return(checkBox);
            }

            if (typeof(Enum).IsAssignableFrom(propertyType))
            {
                ICollection standardValues = descriptor.Converter.GetStandardValues();
                if (standardValues != null)
                {
                    var list = new DropDownPartField();
                    list.ID                     = "DropDown" + propName;
                    list.Options                = GetEditorOptionsAttribute(descriptor.Attributes);
                    list.EditorPartCssClass     = "sn-inputunit ui-helper-clearfix sn-custom-editorpart-enum sn-editorpart-" + propName;
                    list.Title                  = GetDisplayName(descriptor);
                    list.Description            = GetDescription(descriptor);
                    list.TitleContainerCssClass = "sn-iu-label";
                    list.TitleCssClass          = "sn-iu-title";
                    list.DescriptionCssClass    = "sn-iu-desc";
                    list.ControlWrapperCssClass = "sn-iu-control";
                    list.PropertyName           = propName;
                    foreach (object value in standardValues)
                    {
                        var resourceKey = String.Concat("Enum-", propName, "-", value.ToString());
                        var text        = ResourceManager.Current.GetStringOrNull("PortletFramework", resourceKey) as string;
                        if (string.IsNullOrEmpty(text))
                        {
                            text = descriptor.Converter.ConvertToString(value);
                        }
                        list.Items.Add(new ListItem(text, value.ToString()));
                    }
                    return(list);
                }

                return(null);
            }

            var textBox = new TextEditorPartField();

            textBox.ID                     = "TextBox" + propName;
            textBox.Options                = GetEditorOptionsAttribute(descriptor.Attributes);
            textBox.EditorPartCssClass     = "sn-inputunit ui-helper-clearfix sn-custom-editorpart-text sn-editorpart-" + propName;
            textBox.Title                  = GetDisplayName(descriptor);
            textBox.Description            = GetDescription(descriptor);
            textBox.TitleContainerCssClass = "sn-iu-label";
            textBox.TitleCssClass          = "sn-iu-title";
            textBox.DescriptionCssClass    = "sn-iu-desc";
            textBox.ControlWrapperCssClass = "sn-iu-control";
            textBox.Columns                = 30;
            textBox.PropertyName           = propName;
            return(textBox);
        }
示例#22
0
 public override object GetEditor(Type editorBaseType)
 {
     return(originalPropertyDescriptor.GetEditor(editorBaseType));
     //return new MethodEditor();
 }
示例#23
0
 public override object GetEditor(Type editorBaseType)
 {
     return(m_original.GetEditor(editorBaseType));
 }
示例#24
0
 public override object GetEditor(Type editorBaseType)
 {
     return(_basePropertyDescriptor.GetEditor(editorBaseType));
 }
示例#25
0
        private UITypeEditor GetActualEditor(ITypeDescriptorContext context)
        {
            if (context == null)
            {
                return(actualEditor);
            }

            XmlPropertySetting setting = (XmlPropertySetting)context.Instance;

            //Find property
            //setting.Property
            //Find type converter
            //Convert value
            //Find corresponding UITypeEditor
            //Edit converted value

            if (setting.Property == null)
            {
                this.actualEditor = null;
                return(null);
            }

            string[] propertyParts = setting.Property.Split('.');
            string   propertyName;
            string   className;

            if (propertyParts.Length > 1)
            {
                propertyName = propertyParts[propertyParts.Length - 1];
                className    = string.Join(".", propertyParts, 0, propertyParts.Length - 1);
            }
            else
            {
                MessageBox.Show("Invalid property name. Property consist of type FullName\".\"PropertyName.");
                this.actualEditor = null;
                return(null);
            }

            RadProperty prop = RadProperty.FindSafe(className, propertyName);

            this.currProperty = prop;

            TypeConverter converter;

            if (prop != null)
            {
                converter = TypeDescriptor.GetConverter(prop.PropertyType);
            }
            else
            {
                MessageBox.Show("Can't find property " + setting.Property + ". Property " + propertyName + "not registered for RadObject" + className);
                this.actualEditor = null;
                return(null);
            }

            this.actualPropertyType = prop.PropertyType;

            if (converter == null ||
                !converter.CanConvertFrom(typeof(string)) ||
                !converter.CanConvertTo(typeof(string)))
            {
                if (!converter.CanConvertFrom(typeof(string)))
                {
                    MessageBox.Show("Converter can't convert from string");
                }
                else
                if (!converter.CanConvertTo(typeof(string)))
                {
                    MessageBox.Show("Converter can't convert to string");
                }
                else
                {
                    MessageBox.Show("Converter for type not found");
                }

                this.actualEditor = null;
                return(null);
            }

            this.actualConverter = converter;

            PropertyDescriptor actualProperty = TypeDescriptor.GetProperties(prop.OwnerType).Find(prop.Name, false);

            if (actualProperty != null)
            {
                this.actualEditor = (UITypeEditor)actualProperty.GetEditor(typeof(UITypeEditor));
            }
            else
            {
                this.actualEditor = (UITypeEditor)TypeDescriptor.GetEditor(prop.PropertyType, typeof(UITypeEditor));
            }


            return(actualEditor);
        }
示例#26
0
 /// <summary>
 /// Returns an editor for the ValueEditor type</summary>
 /// <returns>Editor for the ValueEditor type</returns>
 public ValueEditor GetCustomEditor()
 {
     return(m_descriptor.GetEditor(typeof(ValueEditor)) as ValueEditor);
 }
        public void Constructor_WithLinkedDatabaseStatus_HlcdFilePathHaveExpectedAttributeValue(bool isLinked)
        {
            // Setup
            var mocks         = new MockRepository();
            var importHandler = mocks.Stub <IHydraulicLocationConfigurationDatabaseImportHandler>();

            mocks.ReplayAll();

            HydraulicBoundaryDatabase hydraulicBoundaryDatabase = isLinked
                                                                      ? CreateLinkedHydraulicBoundaryDatabase()
                                                                      : new HydraulicBoundaryDatabase();

            // Call
            var properties = new HydraulicBoundaryDatabaseProperties(hydraulicBoundaryDatabase, importHandler);

            // Assert
            PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties);

            Assert.AreEqual(12, dynamicProperties.Count);

            const string       expectedCategory    = "Algemeen";
            PropertyDescriptor hrdFilePathProperty = dynamicProperties[hrdFilePathPropertyIndex];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(hrdFilePathProperty,
                                                                            expectedCategory,
                                                                            "HRD bestandslocatie",
                                                                            "Locatie van het HRD bestand.",
                                                                            true);

            PropertyDescriptor hlcdFilePathProperty = dynamicProperties[hlcdFilePathPropertyIndex];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(hlcdFilePathProperty,
                                                                            expectedCategory,
                                                                            "HLCD bestandslocatie",
                                                                            "Locatie van het HLCD bestand.",
                                                                            !isLinked);
            if (isLinked)
            {
                object hlcdFilePathEditor = hlcdFilePathProperty.GetEditor(typeof(UITypeEditor));
                Assert.IsInstanceOf <HlcdFileNameEditor>(hlcdFilePathEditor);
            }

            PropertyDescriptor usePreprocessorClosureProperty = dynamicProperties[usePreprocessorClosurePropertyIndex];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(usePreprocessorClosureProperty,
                                                                            expectedCategory,
                                                                            "Gebruik preprocessor sluitregime database",
                                                                            "Gebruik de preprocessor sluitregime database bij het uitvoeren van een berekening.",
                                                                            true);

            PropertyDescriptor scenarioNameProperty = dynamicProperties[scenarioNamePropertyIndex];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(scenarioNameProperty,
                                                                            expectedCategory,
                                                                            "Klimaatscenario",
                                                                            "Algemene naam van het klimaatscenario.",
                                                                            true);

            PropertyDescriptor yearProperty = dynamicProperties[yearPropertyIndex];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(yearProperty,
                                                                            expectedCategory,
                                                                            "Zichtjaar",
                                                                            "Jaartal van het jaar waarop de statistiek van toepassing is.",
                                                                            true);

            PropertyDescriptor scopeProperty = dynamicProperties[scopePropertyIndex];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(scopeProperty,
                                                                            expectedCategory,
                                                                            "Toepassingskader",
                                                                            "Projectkader waarin de statistiek bedoeld is te gebruiken.",
                                                                            true);

            PropertyDescriptor seaLevelProperty = dynamicProperties[seaLevelPropertyIndex];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(seaLevelProperty,
                                                                            expectedCategory,
                                                                            "Zeewaterstand",
                                                                            "Klimaatinformatie met betrekking tot de zeewaterstand.",
                                                                            true);

            PropertyDescriptor riverDischargeProperty = dynamicProperties[riverDischargePropertyIndex];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(riverDischargeProperty,
                                                                            expectedCategory,
                                                                            "Rivierafvoer",
                                                                            "Klimaatinformatie met betrekking tot de rivierafvoer.",
                                                                            true);

            PropertyDescriptor lakeLevelProperty = dynamicProperties[lakeLevelPropertyIndex];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(lakeLevelProperty,
                                                                            expectedCategory,
                                                                            "Meerpeil",
                                                                            "Klimaatinformatie met betrekking tot het meerpeil/de meerpeilen.",
                                                                            true);

            PropertyDescriptor windDirectionProperty = dynamicProperties[windDirectionPropertyIndex];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(windDirectionProperty,
                                                                            expectedCategory,
                                                                            "Windrichting",
                                                                            "Klimaatinformatie met betrekking tot de windrichting.",
                                                                            true);

            PropertyDescriptor windSpeedProperty = dynamicProperties[windSpeedPropertyIndex];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(windSpeedProperty,
                                                                            expectedCategory,
                                                                            "Windsnelheid",
                                                                            "Klimaatinformatie met betrekking tot de windsnelheid.",
                                                                            true);

            PropertyDescriptor commentProperty = dynamicProperties[commentPropertyIndex];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(commentProperty,
                                                                            expectedCategory,
                                                                            "Overig",
                                                                            "Overige informatie.",
                                                                            true);
        }
示例#28
0
        private UITypeEditor GetActualEditor(ITypeDescriptorContext context)
        {
            if (context == null)
            {
                return(this.actualEditor);
            }
            XmlPropertySetting instance = (XmlPropertySetting)context.Instance;

            if (instance.Property == null)
            {
                this.actualEditor = (UITypeEditor)null;
                return((UITypeEditor)null);
            }
            string[] strArray = instance.Property.Split('.');
            if (strArray.Length > 1)
            {
                string      propertyName = strArray[strArray.Length - 1];
                string      className    = string.Join(".", strArray, 0, strArray.Length - 1);
                RadProperty safe         = RadProperty.FindSafe(className, propertyName);
                this.currProperty = safe;
                if (safe != null)
                {
                    TypeConverter converter = TypeDescriptor.GetConverter(safe.PropertyType);
                    this.actualPropertyType = safe.PropertyType;
                    if (converter == null || !converter.CanConvertFrom(typeof(string)) || !converter.CanConvertTo(typeof(string)))
                    {
                        if (!converter.CanConvertFrom(typeof(string)))
                        {
                            int num1 = (int)MessageBox.Show("Converter can't convert from string");
                        }
                        else if (!converter.CanConvertTo(typeof(string)))
                        {
                            int num2 = (int)MessageBox.Show("Converter can't convert to string");
                        }
                        else
                        {
                            int num3 = (int)MessageBox.Show("Converter for type not found");
                        }
                        this.actualEditor = (UITypeEditor)null;
                        return((UITypeEditor)null);
                    }
                    this.actualConverter = converter;
                    PropertyDescriptor propertyDescriptor = TypeDescriptor.GetProperties(safe.OwnerType).Find(safe.Name, false);
                    this.actualEditor = propertyDescriptor == null ? (UITypeEditor)TypeDescriptor.GetEditor(safe.PropertyType, typeof(UITypeEditor)) : (UITypeEditor)propertyDescriptor.GetEditor(typeof(UITypeEditor));
                    return(this.actualEditor);
                }
                int num = (int)MessageBox.Show("Can't find property " + instance.Property + ". Property " + propertyName + "not registered for RadObject" + className);
                this.actualEditor = (UITypeEditor)null;
                return((UITypeEditor)null);
            }
            int num4 = (int)MessageBox.Show("Invalid property name. Property consist of type FullName\".\"PropertyName.");

            this.actualEditor = (UITypeEditor)null;
            return((UITypeEditor)null);
        }