private async Task SetListening(bool toListen)
{
if (toListen)
{
listening = true;
text.IsEnabled = false;
symbol.Symbol = Symbol.FontColor;
text.PlaceholderText = "waiting";
if (speechRecognizerContinuous != null)
await speechRecognizerContinuous.ContinuousRecognitionSession.CancelAsync();
StartListenMode();
}
else
{
listening = false;
text.IsEnabled = true;
symbol.Symbol = Symbol.Microphone;
Listening.IsActive = false;
text.Text = "";
text.PlaceholderText = "Type something or say 'Start Listening'";
if (speechRecognizerContinuous != null)
await speechRecognizerContinuous.ContinuousRecognitionSession.StartAsync();
}
}