Ejemplo n.º 1
0
        private EventHandler GetLeaveHandler(FieldAndPropertyWrapper arg)
        {
            ActionArgumentAttribute argAttr = arg.GetArgumentAttribute();

            if (argAttr.OnLeaveHandlerName == null)
            {
                return(null);
            }
            Type       actionType = ThisAction.GetType();
            MethodInfo method     = actionType.GetMethod(argAttr.OnLeaveHandlerName);

            return((sender, e) => method.Invoke(ThisAction, new[] { sender, e }));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Populate Attribute table with controls for <see cref="ThisAction"/>'s arguments
        /// </summary>
        protected void GenerateArguments()
        {
            Type actionType = ThisAction.GetType();

            var fieldArguments = from fi in actionType.GetMembers()
                                 where fi is FieldInfo || fi is PropertyInfo
                                 select(FieldAndPropertyWrapper) fi
                                 into wrapped
                                 let argattr = wrapped.GetArgumentAttribute()
                                                   where argattr != null
                                               orderby argattr.DisplayOrder
                                               select wrapped;

            foreach (FieldAndPropertyWrapper arg in fieldArguments)
            {
                AttributeTable.Controls.AddRange(GenerateFieldControls(arg));
            }
        }