按照 Stack Overflow 中的示例,我整理了一个 MessageDialog 来显示我的用户错误消息。在模拟器中,它工作正常。
在电话上,它直接通过,仅在屏幕上闪烁 MessageDialog 片刻,甚至通过 Task.Delay 我作为一种解决方法输入。
有人可以向我解释发生了什么,或者指出我正确的方向吗?
ps 我还在这里为每篇文章尝试了一个 ContentDialog。这甚至不显示消息文本。
这是一个代码片段:
public static async void ShowAndGo (String MessCode, String MessText, Boolean Xit)
{
String Mess = ""; // Start out with an empty Message to tell Joe User.
String Title = ""; // And an empty title too.
if (MessCode != "") // If we're sent a Message "Code,"
Mess = App.ResLdr.GetString (MessCode) + Cx.ld + Cx.ld; // turn it into text, culturally-aware.
Mess += MessText; // Stick MessText onto the end of it.
if (Xit)
Title = App.ResLdr.GetString ("OhSnap"); // If we're goin' down, curse a little.
else
Title = App.ResLdr.GetString ("NoProb"); // If it's just informational, no problem-o.
MessageDialog messageDialog = new MessageDialog (Mess, Title);
await messageDialog.ShowAsync (); // IT FREAKING ISN'T STOPPING HERE!!!
Task.Delay (10000).Wait (); // Wait 10 seconds with error message on the screen.
// AND IT FREAKING DOESN'T STOP HERE EITHER!!!
}