BalloonsPop.Core.Commands.CommandFactory.RegisterCommand C# (CSharp) Метод

RegisterCommand() публичный Метод

A method to register a new command.
public RegisterCommand ( string commandKey, Func commandProvidingMethod ) : void
commandKey string
commandProvidingMethod Func
Результат void
        public void RegisterCommand(string commandKey, Func<ICommand> commandProvidingMethod)
        {
            if (!this.commandMap.ContainsKey(commandKey))
            {
                this.commandMap.Add(commandKey, commandProvidingMethod);
            }
        }

Usage Example

Пример #1
0
        /// <summary>
        /// Provides loading for the wpf module exports.
        /// </summary>
        public override void Load()
        {
            this.AppKernel.Bind<ICommandFactory>().ToMethod(x =>
            {
                var newCmdFactory = new CommandFactory();

                newCmdFactory.UnregisterCommand(WpfExitCommandKey);
                newCmdFactory.RegisterCommand(WpfExitCommandKey, WpfProviderMethod);

                return newCmdFactory;
            });
        }