public IMenu AddAction(string actionName)
        {
            IActionSpecImmutable actionSpec = ActionsForObject.FirstOrDefault(a => a.Identifier.MemberName == actionName);

            if (actionSpec == null)
            {
                throw new ReflectionException(Log.LogAndReturn($"No such action: {actionName} on {Type}"));
            }
            AddMenuItem(new MenuAction(actionSpec));
            return(this);
        }
Exemple #2
0
        public IMenu AddAction(string actionName)
        {
            if (Type == null)
            {
                throw new Exception($"No type has been specified for the action: {actionName}");
            }
            var actionSpec = ActionsForObject.FirstOrDefault(a => a.Identifier.MemberName == actionName);

            if (actionSpec == null)
            {
                throw new ReflectionException($"No such action: {actionName} on {Type}");
            }

            AddMenuItem(new MenuAction(actionSpec));
            return(this);
        }