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); } }
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); }
public void Add(IActionCommand command) { if (command == null) { throw new ArgumentNullException(nameof(command)); } Type type = command.GetType(); IActionCommandList commands = Get(type); commands.Add(command); }
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); }
public void ClearCommands(Type type) { IActionCommandList commands = Get(type); commands.Clear(); }
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); }