Exemplo n.º 1
0
        internal ActionPropertyDescriptor(ObjectAdapter adapter, string name, JObject jObject)
            : base(name, null)
        {
            actionAdapter = new ActionAdapter(adapter, name, jObject);

            this.AttributeArray = new Attribute[] {
                new CategoryAttribute("Actions"),
                new DisplayNameAttribute(actionAdapter.displayName),
                new DescriptionAttribute((string)jObject["description"])
            };
        }
Exemplo n.º 2
0
        internal ActionParamPropertyDescriptor(ActionAdapter adapter, string name, JObject jObject)
            : base(name, null)
        {
            m_actionAdapter = adapter;
            m_name          = name;

            string typeName = (string)jObject["type"];

            m_type = DataTypes.NameToType(typeName);

            m_value = null;

            this.AttributeArray = new Attribute[] {
                new CategoryAttribute("Parameters"),
                new DescriptionAttribute((string)jObject["description"])
            };
        }
Exemplo n.º 3
0
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (context != null)
            {
                ActionPropertyDescriptor desc = context.PropertyDescriptor as ActionPropertyDescriptor;
                if (desc != null)
                {
                    ActionAdapter adapter = desc.actionAdapter;
                    if (!adapter.requireConfirm ||
                        MessageBox.Show("Confirm execution of action " + adapter.displayName, "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes
                        )
                    {
                        adapter.ExecuteAction();
                    }
                }
            }

            return(value);
        }