Ejemplo n.º 1
0
 private void CanceledHandler(object sender, TranslationRecognitionCanceledEventArgs e)
 {
     lock (_threadLocker)
     {
         _message = e.ErrorDetails.ToString();
         Debug.Log("CanceledHandler: " + _message);
     }
 }
    // "Canceled" events are fired if the server encounters some kind of error.
    // This is often caused by invalid subscription credentials.
    private void CanceledTranslationHandler(object sender, TranslationRecognitionCanceledEventArgs e)
    {
        Debug.Log($"CANCELED: Reason={e.Reason}");

        errorString = e.ToString();
        if (e.Reason == CancellationReason.Error)
        {
            Debug.LogError($"CANCELED: ErrorDetails={e.ErrorDetails}");
            Debug.LogError($"CANCELED: Did you update the subscription info?");
        }
    }
Ejemplo n.º 3
0
 /// <summary>
 /// Called when translation is canceled.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="TranslationRecognitionCanceledEventArgs"/> instance containing the event data.</param>
 private void OnCanceledEventHandler(object sender, TranslationRecognitionCanceledEventArgs e)
 {
     //string text = $"Speech recognition: canceled. Reason: {e.Reason}, ErrorDetails: {e.ErrorDetails}";
     //this.SetCurrentText(this.crisCurrentText, text);
     //text += "\n";
     //this.WriteLine(this.crisLogText, text);
     //if (this.started)
     //{
     //    this.recognizer.StopContinuousRecognitionAsync().Wait();
     //    this.started = false;
     //}
 }
        private async void OnTranslateCanceled(object sender, TranslationRecognitionCanceledEventArgs args)
        {
            if (args.Reason == CancellationReason.Error)
            {
                stopRecognitionTaskCompletionSource?.TrySetResult(0);

                await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                {
                    dictatedTextBuilder = new StringBuilder($"ErrorCode={args.ErrorCode};\nErrorDetails={args.ErrorDetails}");
                    recognitionData     = new RecognitionData(dictatedTextBuilder.ToString(), null);
                    UpdateTextBox(this.dictationTextBlock, recognitionData);

                    ShowNotificationEventHandler?.Invoke(this, new NotificationViewModel {
                        NotificationType = NotificationType.Error
                    });
                });
            }
        }
 private void OnCanceled(object sender, TranslationRecognitionCanceledEventArgs e)
 {
     SendMessage(e.ErrorDetails);
 }