public void TestNormalFlow()
        {
            timeBasedCommand.SetCommand("bla", 3000);
            Thread.Sleep(200);

            Assert.AreSame(timeBasedCommand.CurrentCommand, "bla", "Command after 200 ms");

            timeBasedCommand.SetCommand("blubb", 400);
            Thread.Sleep(200);

            Assert.AreSame(timeBasedCommand.CurrentCommand, "blubb", "Command after 400 ms");

            Thread.Sleep(400);      // The command "blubb" is suspended at 600 ms

            Assert.IsNull(timeBasedCommand.CurrentCommand, "Command after 800 ms");
        }
Exemple #2
0
        private void UpdateCurrentlyRecognizedCommand(String commandSentence)
        {
            System.Console.WriteLine("Recognized + '" + commandSentence + "'");

            if (currentMode == SpeechMode.Controlled)
            {
                int    duration = 0;
                String command  = "";
                SpeechMapping.ExtractCommandFromSentence(commandSentence, out command, out duration);

                if (command != null && command != "" && duration > 0)
                {
                    timeBasedCommand.SetCommand(command, duration);
                }
            }
            else if (currentMode == SpeechMode.Raw)
            {
                timeBasedCommand.SetCommand(commandSentence, 400);
            }
        }