Ejemplo n.º 1
0
        /// <summary>
        /// Set the UI based on the current state of the speech state machine
        /// </summary>
        /// <param name="state"></param>
        private void SpeechSetUIState(NuanceHelper.SpeechState state)
        {
            switch (state)
            {
                case NuanceHelper.SpeechState.Initializing:
                    //parent.SpeechPopup.Title = "initializing...";
                    parent.SpeechTextLabel.Text = "initializing...";
                    break;
                case NuanceHelper.SpeechState.Listening:
                    //parent.SpeechPopup.Title = "listening...";
                    parent.SpeechTextLabel.Text = "listening...";
                    break;
                case NuanceHelper.SpeechState.Recognizing:
                    //parent.SpeechPopup.Title = "recognizing...";
                    //parent.ActivityIndicator.Hidden = false;
                    parent.SpeechTextLabel.Text = "recognizing...";
                    break;
                case NuanceHelper.SpeechState.Finished:
                    //parent.SpeechPopup.Title = "";
                    parent.SpeechTextLabel.Text = "";
                    break;
            }

            // resize and recenter the label
            parent.SpeechTextLabel.SizeToFit();
            parent.SpeechTextLabel.Center = new PointF(parent.View.Center.X, parent.ActivityIndicator.Center.Y);
        }
Ejemplo n.º 2
0
        public void SpeechPopup_SpeechStateCallback(NuanceHelper.SpeechState state, string message)
        {
            speechState = state;
            SpeechSetUIState(speechState);

            // store debug / timing info
            TimeSpan ts = DateTime.Now - speechStart;
            string stateString = NuanceHelper.SpeechStateString(state);
            string traceString = String.Format("New state: {0}; Time: {1}; Message: {2}", stateString, ts.TotalSeconds, message);
            TraceHelper.AddMessage(traceString);
            speechDebugString += traceString + "\n";
        }