コード例 #1
0
        private void worker_DoWork(object sender, DoWorkEventArgs e)
        {
            //Logic for simple recognition activity

            // Set a 3 second timeout for the recognition (optional)
            _tempVr.SetTimeout(3);
            //instruct the module to listen for a built in word from the 1st wordset
            _tempVr.RecognizeWord(1);


            Response = Response + ("Speak" + Environment.NewLine);


            //need to wait until HasFinished has completed before collecting results
            while (!_tempVr.HasFinished())
            {
                Response = Response + (".");
            }

            // Once HasFinished has returned true, we can ask the module for the index of the word it recognised. If you're new to using the EasyVR module,
            // download the Easy VR Commander (http://www.veear.eu/downloads/) to interrogate the config of your module and see what the indexes correspond to
            // Here is a standard setup at time of writing for an EASYVR 3 module:
            // 0=Action,1=Move,2=Turn,3=Run,4=Look,5=Attack,6=Stop,7=Hello

            // NOTE: Depending on what you are looking to recognise, you may need a different method to GetWord() - GetToken and GetCommand are also available
            var indexOfRecognisedWord = _tempVr.GetWord();

            Response = Response + ("Response: " + indexOfRecognisedWord + Environment.NewLine);
            Response = Response + ("Recognition finished" + Environment.NewLine);
        }