/// <summary> /// Helper to handle event dispatch for rejected speech utterances. /// </summary> /// <param name="command"> /// Text of speech command that was rejected. May be <code>null</code>. /// </param> /// <param name="confidenceLevel"> /// Value (from 0.0 to 1.0) assigned by the recognizer that represents the likelihood that a /// recognized phrase matches a given input. /// </param> /// <param name="activeModeRecognition"> /// <code>true</code> if speech commander was in active listening mode when this event came in. /// <code>false</code> otherwise. /// </param> private void OnSpeechRejected(string command, double confidenceLevel, bool activeModeRecognition) { if (this.SpeechRejected != null) { SpeechCommanderEventArgs e = new SpeechCommanderEventArgs(); e.Command = command; e.ConfidenceLevel = confidenceLevel; e.ActiveModeRecognition = activeModeRecognition; this.SpeechRejected(this, e); } }
private void KinectSpeechCommander_SpeechRecognized(object sender, SpeechCommanderEventArgs e) { switch (e.Command) { case "IRMODE_NEAR": try { this.KinectSensorManager.DepthRange = DepthRange.Near; textBlockActionFeedback.Text = "Range: Near"; } catch (InvalidOperationException) { textBlockActionFeedback.Text = "Near mode is not supported."; } this.OnVoiceCommandActivated(); break; case "IRMODE_DEFAULT": this.KinectSensorManager.DepthRange = DepthRange.Default; textBlockActionFeedback.Text = "Range: Default"; this.OnVoiceCommandActivated(); break; case "STMODE_SEATED": this.KinectSensorManager.SkeletonTrackingMode = SkeletonTrackingMode.Seated; textBlockActionFeedback.Text = "Skeleton: Seated"; this.OnVoiceCommandActivated(); break; case "STMODE_DEFAULT": this.KinectSensorManager.SkeletonTrackingMode = SkeletonTrackingMode.Default; textBlockActionFeedback.Text = "Skeleton: Default"; this.OnVoiceCommandActivated(); break; default: break; } }