原帖地址http://bbs.csdn.net/topics/390493097
修改的代码如下:public int GetUserChoice()
{
    int choice = 0;
var task = this.Dispatcher.RunAsync(CoreDispatcherPriority.High,()=>
{
MessageDialog d = new MessageDialog("请选择:");
d.Commands.Add(new UICommand("类型1", null, 1));
d.Commands.Add(new UICommand("类型2", null, 2));
d.Commands.Add(new UICommand("类型3", null, 3));
var task1 = d.ShowAsync().AsTask();
var result = task1.WaitAndUnwrapException().Result;
choice = Convert.ToInt32(result.Id);
}).AsTask();
task.WaitAndUnwrapException();
    return choice;
}因为是事件触发,所以要用Dispatcher去弹出消息框。
现在的问题是,消息框不能弹出来。如果把弹出消息框的方法换成其他的不与界面交互的耗时方法就能成功。我在想是不是GetUserChoice本身阻塞了UI线程,导致如果此方法不返回的话,其他界面交互的方法就不能执行。但这个方法又必须等界面交互结束后才能得到返回结果。请问有什么方法可以解决?Metro里面有没有类似Application.DoEvent的方法?