Example #1
0
        public ICommand AddCommand(ICommand command, int position = -1)
        {
            if (commands.IndexOf(command) > -1)
            {
                throw new Exception("This Command instance has already been added!!!!!!");
            }

            if (position > -1)
            {
                if (position >= commands.Count)
                {
                    position = commands.Count;
                }
                commands.Insert(position, command);
            }
            else
            {
                commands.Add(command);
            }

            command.AddCallback(this);

            return(command);
        }