Пример #1
0
        private static object GetEditorKey(PropertyNode node, bool editable, EditorKeyType keyType)
        {
            Type propertyType = node.PropertyType;
            object obj2 = node.Value;

            if (editable && propertyType != null)
            {
                if (propertyType == typeof(bool))
                {
                    if (keyType == EditorKeyType.Style)
                        return PropertyGrid.BoolEditorStyleKey;
                    return PropertyGrid.BoolEditorTemplateKey;
                }
                if (((propertyType != null) && node.StandardValues != null))
                {
                    if (keyType == EditorKeyType.Style)
                        return PropertyGrid.ComboEditorStyleKey;
                    return PropertyGrid.ComboEditorTemplateKey;
                }
                if (s_simpleTypes.Contains(propertyType))
                {
                    if (keyType == EditorKeyType.Style)
                        return PropertyGrid.DefaultTextEditorStyleKey;
                    return PropertyGrid.DefaultTextEditorTemplateKey;
                }
            }

            if (keyType == EditorKeyType.Style)
                return PropertyGrid.ReadOnlyStyleKey;
            return PropertyGrid.ReadOnlyTemplateKey;
        }
Пример #2
0
        private static object GetEditorKey(PropertyNode node, bool editable, EditorKeyType keyType)
        {
            Type propertyType = node.PropertyType;

            if (propertyType != null)
            {
                if (propertyType == typeof(bool))
                {
                    if (keyType == EditorKeyType.Style)
                    {
                        return(PropertyGrid.BoolEditorStyleKey);
                    }
                    return(PropertyGrid.BoolEditorTemplateKey);
                }

                if (editable)
                {
                    if (node.StandardValues != null)
                    {
                        if (keyType == EditorKeyType.Style)
                        {
                            return(PropertyGrid.ComboEditorStyleKey);
                        }
                        return(PropertyGrid.ComboEditorTemplateKey);
                    }

                    if (s_simpleTypes.Contains(propertyType))
                    {
                        if (keyType == EditorKeyType.Style)
                        {
                            return(PropertyGrid.DefaultTextEditorStyleKey);
                        }
                        return(PropertyGrid.DefaultTextEditorTemplateKey);
                    }
                }
            }

            if (keyType == EditorKeyType.Style)
            {
                return(PropertyGrid.ReadOnlyStyleKey);
            }
            return(PropertyGrid.ReadOnlyTemplateKey);
        }