public void SpeakEffect(AudioGesture effect) { var args = NarrationEventArgs.Create(effect); _lastNarrationEventArgs = args; _narrator.OnNarrationEvent(args); TelemetryMessage.Telemetry.TraceEvent(TraceEventType.Information, IdMapper.GetId <AudioGesture>(), effect.ToString()); }
void RaiseNarrationEvent(object key, NarrationEventType eventType, string completedWord) { if (IsAllSelected) { _trainingStartTime = DateTime.UtcNow; _trainingKeyCount = 1; } else { _trainingKeyCount++; } var args = NarrationEventArgs.Create(key, eventType, TextSlice.Text, TextSlice.Start, IsAllSelected, completedWord); _lastNarrationEventArgs = args; _narrator.OnNarrationEvent(args); }
IPrediction DisplaySuggestions(int seedLength, IEnumerable <IPredictionSuggestion> wordSuggestions, IEnumerable <IPredictionSuggestion> phraseSuggestions) { if (_queuedPrediction == null) { var isShifted = ShiftToggleState.IsChecked; var suggestions = new List <string>(); var itemPosition = 0; foreach (var suggestion in wordSuggestions) { if (itemPosition < SuggestionItems.Count) { var item = SuggestionItems[itemPosition]; var shiftedText = ShiftText(isShifted, suggestion.Text); item.Keytop = shiftedText; item.Visibility = Visibility.Visible; item.IsEnabled = true; item.Suggestion = suggestion; suggestions.Add(shiftedText); } itemPosition++; } while (itemPosition < SuggestionItems.Count) { var item = SuggestionItems[itemPosition]; itemPosition++; item.Visibility = Visibility.Collapsed; item.Suggestion = null; } SuggestionsHelper.SetSuggestions(suggestions); if (suggestions.Count != 0 && _lastNarrationEventArgs != null && (seedLength != 0 || _environment.AppSettings.Prediction.PredictionNovelty == PredictionNovelty.FromScratch)) { var args = NarrationEventArgs.Create(_lastNarrationEventArgs, suggestions[0]); _narrator.OnNarrationEvent(args); } itemPosition = 0; foreach (var phrase in phraseSuggestions) { if (itemPosition < PhraseItems.Count) { var item = PhraseItems[itemPosition]; item.Keytop = phrase.Text; item.Visibility = Visibility.Visible; item.IsEnabled = true; item.Suggestion = phrase; } itemPosition++; } while (itemPosition < PhraseItems.Count) { var item = PhraseItems[itemPosition]; itemPosition++; item.Visibility = Visibility.Collapsed; item.Suggestion = null; } } var prediction = _queuedPrediction; _queuedPrediction = null; _suggesterRunning = prediction != null; return(prediction); }