예제 #1
0
        /// <summary>
        /// Retrieve the command name for this action
        /// </summary>
        /// <param name="action"></param>
        /// <returns></returns>
        public static string GetCommandName(this IAction action)
        {
            Type   type = action.GetType();
            string commandName;

            object[] typeAtts = type.GetCustomAttributes(typeof(ActionAttribute), false);
            if (typeAtts.Count() > 0)
            {
                ActionAttribute aAtt = (ActionAttribute)typeAtts[0];
                commandName = aAtt.CommandName;
            }
            else
            {
                commandName = type.Name;
            }
            return(commandName);
        }
예제 #2
0
 /// <summary>
 /// Retrieve the action attributes for this action
 /// </summary>
 /// <param name="action"></param>
 /// <returns></returns>
 public static ActionAttribute GetAttributes(this IAction action)
 {
     return(ActionAttribute.ExtractFrom(action));
 }