public void AssignKey(Keys k, ICommand command)
 {
     if (AvailableCommands.Contains(command))
     {
         AssignedCommands[k] = command;
     }
     else
     {
         throw new CommandUnavailableException();
     }
 }
예제 #2
0
        /// <summary>
        /// Assign A button to a command
        /// </summary>
        /// <param name="b">Button to assign</param>
        /// <param name="command">ICommand button is assigned to</param>
        public void AssignButton(Buttons b, ICommand command)
        {
            if (StickOneDown == command || StickOneUp == command || StickOneLeft == command || StickOneRight == command ||
                StickTwoDown == command || StickTwoUp == command || StickTwoLeft == command || StickTwoRight == command)
            {
                throw new UnchangeableCommandException();
            }

            if (AvailableCommands.Contains(command))
            {
                AssignedCommands[b] = command;
            }
            else
            {
                throw new CommandUnavailableException();
            }
        }