我有一个应用程序,它将从 web 服务中检索一个值并宣布结果。然而,演讲似乎只会说最后几句话。我不认为这是由于网络服务造成的,因为即使我将它设置为说一个固定的句子,也会发生同样的问题。
例如,我可能会收到下面的演讲“在 XYZ 还剩很多”。
有任何想法吗?
private async Task Speak(ObservableCollection<CarPark> rs)
{
if (rs.Count == 1)
{
await Speak(string.Format("There are {0} lots left at {1}", rs[0].lots.ToString(), rs[0].development.ToString()));
}
}
...
public async Task Speak(string text)
{
SpeechSynthesizer tts = new SpeechSynthesizer();
await tts.SpeakTextAsync(text);
}
private async Task CollectCarPark(string Development)
{
ObservableCollection<CarPark> rs = new ObservableCollection<CarPark>();
HttpClient httpClient = new HttpClient();
rs = await httpClient.getCarParkSetResult(Development);
await ShowCarParkRowset(rs, false);
await Speech.Speak(rs);
}
------------------
public static async Task Speak(string text)
{
await Initialize();
await synthesizer.SpeakTextAsync("Welcome to Get A Lot.");
await synthesizer.SpeakTextAsync("Searching.. ");
await synthesizer.SpeakTextAsync(text);
}