/// <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); }
/// <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)); }