Exemple #1
0
        private UITypeEditor lookUpEditor(ITypeDescriptorContext context)
        {
            if (context != null && context.Instance != null && typeof(WhiskeyPropertyContainer).IsAssignableFrom(context.Instance.GetType()))
            {
                WhiskeyPropertyContainer wpc = (WhiskeyPropertyContainer)context.Instance;
                return(WhiskeyTypeEditors.lookUp(wpc.TypeName));
            }

            return(null);
        }
        public void refreshScripts()
        {
            ScriptProperties.ForEach((s) => { PropertyGrid.removeOtherProperty(s); });
            ScriptProperties.Clear();
            Descriptor.getScriptNames().ForEach((s) =>
            {
                InstanceScriptRhapper dumb    = new InstanceScriptRhapper();
                dumb.Descriptor               = Descriptor;
                dumb.ScriptName               = s;
                GeneralPropertyDescriptor gpd = PropertyGrid.addOtherProperty(s, "Scripts", dumb);
                gpd.CustomTypeEditor          = WhiskeyTypeEditors.lookUp("InstanceScriptRhapper");

                //gpd.PropIsReadOnly = true;
                ScriptProperties.Add(gpd);
            });
        }
        private UITypeEditor lookUpEditor(ITypeDescriptorContext context)
        {
            if (context != null && context.PropertyDescriptor is GeneralPropertyDescriptor)
            {
                GeneralPropertyDescriptor gpd = (GeneralPropertyDescriptor)context.PropertyDescriptor;

                if (gpd.PropValue != null && typeof(WhiskeyPropertyContainer).IsAssignableFrom(gpd.PropValue.GetType()))
                {
                    WhiskeyPropertyContainer wpc = (WhiskeyPropertyContainer)gpd.PropValue;
                    //if (editors.ContainsKey(wpc.TypeName))
                    //{
                    //    return editors[wpc.TypeName];
                    //}
                    return(WhiskeyTypeEditors.lookUp(wpc.TypeName));
                }
            }
            return(null);
        }