Пример #1
0
        public bool TryGet(Type type, out IActionCommandList commands)
        {
            if (type == null)
            {
                throw new ArgumentNullException(nameof(type));
            }

            return(m_commands.TryGetValue(type, out commands));
        }
        public void CopyTo(IActionCommandList <TCommand> commands)
        {
            for (int i = 0; i < m_commands.Count; i++)
            {
                TCommand command = m_commands[i];

                commands.Add(command);
            }
        }
Пример #3
0
        public bool TryGet <T>(out IActionCommandList <T> commands) where T : IActionCommand
        {
            if (TryGet(typeof(T), out IActionCommandList value))
            {
                commands = (IActionCommandList <T>)value;
                return(true);
            }

            commands = null;
            return(false);
        }
Пример #4
0
        public void Add(IActionCommand command)
        {
            if (command == null)
            {
                throw new ArgumentNullException(nameof(command));
            }

            Type type = command.GetType();
            IActionCommandList commands = Get(type);

            commands.Add(command);
        }
Пример #5
0
        public void Add(Type type, IActionCommandList commands)
        {
            if (type == null)
            {
                throw new ArgumentNullException(nameof(type));
            }
            if (commands == null)
            {
                throw new ArgumentNullException(nameof(commands));
            }

            m_commands.Add(type, commands);
        }
Пример #6
0
        public void ClearCommands(Type type)
        {
            IActionCommandList commands = Get(type);

            commands.Clear();
        }
Пример #7
0
        public void Add <T>(T command) where T : IActionCommand
        {
            IActionCommandList <T> commands = Get <T>();

            commands.Add(command);
        }
 void IActionCommandList.CopyTo(IActionCommandList commands)
 {
     CopyTo((IActionCommandList <TCommand>)commands);
 }