/// <summary>
        /// register a new action handler
        /// </summary>
        /// <param name="actionType"></param>
        /// <param name="configureAction"></param>
        public void AddAction(Type actionType, Action <ActionDefinitionBuilder> configureAction = null)
        {
            var definition = new ActionDefinitionBuilder(actionType);

            configureAction?.Invoke(definition);
            this.RegisteredActionHandlers.Add(definition);
            this.services.AddTransient(actionType);
        }
Esempio n. 2
0
 /// <summary>
 /// Create a definition from a builder.
 /// </summary>
 /// <param name="builder"></param>
 public ActionDefinition(ActionDefinitionBuilder builder)
 {
     // fallback to attributes and clas names etc
     this.Icon = builder.Icon;
     this.Name = builder.Name;
     this.SupportedInMultiActions = builder.SupportedInMultiActions;
     this.VisibleInActionsList    = builder.VisibleInActionsList;
     this.Tooltip = builder.Tooltip;
     this.UUID    = builder.UUID?.ToLower();
     this.Handler = builder.Handler;
     this.States  = new[] {
         builder.DefaultState,
         builder.AlternativeState
     }.Where(s => s != null).ToList();
 }