private void TextBoxTalkWindowOnKeyPress(object sender, KeyPressEventArgs keyPressEventArgs)
{
try
{
if (keyPressEventArgs.KeyChar == '\r')
{
var para = getPreviousPara();
if (String.IsNullOrEmpty(TextBoxTalkWindow.Text.Trim()))
{
return;
}
String textToSpeak;
using (var context = Context.AppAgentMgr.ActiveContext())
{
context.TextAgent().GetParagraphAtCaret(out textToSpeak);
}
if (String.IsNullOrEmpty(textToSpeak) && !String.IsNullOrEmpty(para))
{
keyPressEventArgs.Handled = true;
textToSpeech(para);
}
else
{
ttsAndLearn(textToSpeak);
}
}
}
catch (Exception ex)
{
Log.Exception(ex);
}
}