1
0
Fork 0
mirror of https://github.com/Nioux/AideDeJeu.git synced 2025-10-29 14:35:45 +00:00

Langue parlée

This commit is contained in:
Yan Maniez 2019-09-22 00:21:22 +02:00
parent e4d6c9f542
commit 4c6d2563cd

View file

@ -60,7 +60,18 @@ namespace AideDeJeu.ViewModels
_CancellationTokenSource = new CancellationTokenSource();
OnPropertyChanged(nameof(Speaking));
OnPropertyChanged(nameof(NotSpeaking));
await Xamarin.Essentials.TextToSpeech.SpeakAsync(md, _CancellationTokenSource.Token);
var options = new Xamarin.Essentials.SpeechOptions();
var locales = (await Xamarin.Essentials.TextToSpeech.GetLocalesAsync()).ToList();
if (item.Id.Contains("_vo.md"))
{
options.Locale = locales.FirstOrDefault(l => l.Language.StartsWith("en"));
}
else
{
options.Locale = locales.FirstOrDefault(l => l.Language.StartsWith("fr"));
}
await Xamarin.Essentials.TextToSpeech.SpeakAsync(md, options, _CancellationTokenSource.Token);
}
catch (Exception ex)
{