private async void Con_Result(SpeechContinuousRecognitionSession sender, SpeechContinuousRecognitionResultGeneratedEventArgs args) { if (args.Result.Text == "note finished") { await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => talkBack("note recorded")); await sender.StopAsync(); //SetListening(true); } }
private async void Con_Result(SpeechContinuousRecognitionSession sender, SpeechContinuousRecognitionResultGeneratedEventArgs args) { if (args.Result.Text.Contains("yes")) { if (marked) { queCounter++; marked = false; } if (queCounter == 1) { await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => talkBack(questionList[queCounter])); await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => tick1.Visibility = Visibility.Visible); queCounter++; } else if (queCounter == 2) { await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => talkBack(questionList[queCounter])); await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => tick2.Visibility = Visibility.Visible); queCounter++; } else if (queCounter == 3) { await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => talkBack(questionList[queCounter])); await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => tick3.Visibility = Visibility.Visible); queCounter++; } else if (queCounter == 4) { await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => talkBack(questionList[queCounter])); await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => tick4.Visibility = Visibility.Visible); queCounter++; } else if (queCounter == questionList.Count()) { await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => tick5.Visibility = Visibility.Visible); await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => talkBack("Sign in checklist complete, you can track equipment now.")); await sender.StopAsync(); } } }
private async void Con_Result(SpeechContinuousRecognitionSession sender, SpeechContinuousRecognitionResultGeneratedEventArgs args) { switch (args.Result.Text) { case "sponge in": await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => talkBack("Noted")); spongeIn++; await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => SetNumber(spongInC, spongeIn)); break; case "sponge out": await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => talkBack("Noted")); spongeOut++; await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => SetNumber( spongOutC,spongeOut)); break; case "instrument in": await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => talkBack("Noted")); instruIn++; await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => SetNumber( instInC, instruIn)); break; case "needle in": await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => talkBack("Noted")); needleIn++; await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => SetNumber( needleInC,needleIn)); break; case "instrument out": await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => talkBack("Noted")); instruOut++; await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => SetNumber( instOutC,instruOut)); break; case "needle out": await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => talkBack("Noted")); needleOut++; await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => SetNumber( needleOutC,needleOut)); break; case "going to close": if (spongeIn != spongeOut) { await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => talkBack("I'm concerned. There is "+ (int) Math.Abs(spongeIn-spongeOut)+" sponge not accounted for. "+spongeIn+" In, "+ spongeOut+" out")); } else if (needleIn != needleOut) { await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => talkBack("I'm concerned. There is " + (int) Math.Abs(needleIn - needleOut) + " needle not accounted for. " + needleIn + " in, " + needleOut + " out.")); } else if (instruIn != instruOut) { await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => talkBack("I'm concerned. There is " + (int) Math.Abs(instruIn - instruOut) + " instrument not accounted for. " + instruIn + " in, " + instruOut + " out.")); } else { await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => talkBack("I have countered " + spongeIn + " in sponge, " + spongeOut + " out sponge, " + instruIn + " in instrument, " + instruOut + " out instrument, " + needleIn + " in needle, " + needleOut + " out needle. Count seems OK")); instruIn = instruOut = needleIn = needleOut = spongeIn = spongeOut = 0; await sender.StopAsync(); } break; } }