Exemplo n.º 1
0
        public async Task<TextDictationResult> GetDictatedText()
        {
            var retval = new TextDictationResult();

            var recognizer = new SpeechRecognizerUI();

            var result = await recognizer.RecognizeWithUIAsync();

            if (result.ResultStatus == SpeechRecognitionUIStatus.Succeeded)
            {
                retval.SuccesfulRecognition = true;
                retval.Text = result.RecognitionResult.Text;

                var userConfirms = await AskSendRepeatCancelQuestion();

                if (userConfirms == SendRepeatCancel.Send)
                    retval.UserCancelled = false;
                else if (userConfirms == SendRepeatCancel.Repeat)
                    return await GetDictatedText();
                else if (userConfirms == SendRepeatCancel.Cancel)
                    retval.UserCancelled = true;
            }
            else
            {
                retval.SuccesfulRecognition = false;
                retval.UserCancelled = false;
                retval.Text = String.Empty;
            }

            return retval;
        }
Exemplo n.º 2
0
        public async Task <TextDictationResult> GetDictatedText()
        {
            var retval = new TextDictationResult();

            var recognizer = new SpeechRecognizerUI();

            var result = await recognizer.RecognizeWithUIAsync();

            if (result.ResultStatus == SpeechRecognitionUIStatus.Succeeded)
            {
                retval.SuccesfulRecognition = true;
                retval.Text = result.RecognitionResult.Text;

                var userConfirms = await AskSendRepeatCancelQuestion();

                if (userConfirms == SendRepeatCancel.Send)
                {
                    retval.UserCancelled = false;
                }
                else if (userConfirms == SendRepeatCancel.Repeat)
                {
                    return(await GetDictatedText());
                }
                else if (userConfirms == SendRepeatCancel.Cancel)
                {
                    retval.UserCancelled = true;
                }
            }
            else
            {
                retval.SuccesfulRecognition = false;
                retval.UserCancelled        = false;
                retval.Text = String.Empty;
            }

            return(retval);
        }