在Windows Phone 8中,我有以下一段使用文本转语音功能的代码。我正在使用带有书签的ssml。但是,当更改Bookmark事件中的任何UI元素(称为函数)时,会引发未授权的异常。System.UnauthorizedAccessException在Windows Phone 8中使用文本转语音功能
private void Initialise_synthesizer()
{
this.synthesizer = new SpeechSynthesizer();
synthesizer.BookmarkReached += new TypedEventHandler<SpeechSynthesizer, SpeechBookmarkReachedEventArgs>
(BookmarkReached);
}
void BookmarkReached(object sender, SpeechBookmarkReachedEventArgs e)
{
Debugger.Log(1, "Info", e.Bookmark + " mark reached\n");
switch (e.Bookmark)
{
case "START":
cur = start;
break;
case "LINE_BREAK":
cur++;
break;
}
**error here** t1.Text = cur.ToString();
}
但在运行它提供了以下错误
A first chance exception of type 'System.UnauthorizedAccessException' occurred in System.Windows.ni.dll
An exception of type 'System.UnauthorizedAccessException' occurred in System.Windows.ni.dll and wasn't handled before a managed/native boundary
Invalid cross-thread access.
任何想法如何围绕解决这个错误,或任何工作。
它 -
由于
synthesizer.SpeakSsmlAsync()
是一个异步函数,执行UI操作调度员已被使用,这样的事情。 –