Exemplo n.º 1
0
        /// <summary>
        /// 注册命令
        /// </summary>
        public static void RegisterCommand(ICommandItemBuilder builder)
        {
            var type = builder.TargetType ?? typeof(object);

            if (CommandBuilders.ContainsKey(type))
            {
                CommandBuilders[type].Add(builder);
            }
            else
            {
                CommandBuilders.Add(type, new List <ICommandItemBuilder> {
                    builder
                });
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 注册命令
        /// </summary>
        /// <typeparam name="TArgument"></typeparam>
        public static void RegisterCommand <TArgument>(ICommandItemBuilder builder)
        {
            var type = typeof(TArgument);

            if (Commands.ContainsKey(type))
            {
                Commands[type].Add(builder);
            }
            else
            {
                Commands.Add(type, new List <ICommandItemBuilder> {
                    builder
                });
            }
        }