Пример #1
0
        private bool DoResponse(int timeout)
        {
            string response = null;

            try
            {
                response = ConsoleReader.ReadLine(timeout);
                int choice = (int)Convert.ChangeType(response, typeof(int));
                this.gameEvent = new ChoiceEvent(choice);
                return(true);
            }
            catch (FormatException)
            {
                Display("Invalid response '" + response + "', reprompting\n");
            }
            catch (TimeoutException)
            {
                Display("Timeout after " + timeout + "ms, reprompting\n");
            }

            return(false);
        }