1
我正在Windows Phone 8上开发一个应用程序,我想问一下在MessageBox被包装在Deployment.Current.Dispatcher.BeginInvoke中时,是否有任何方法从MessageBox.Show中获取结果?例如:如何从Deployment.Current.Dispatcher.BeginInvoke获取结果?
Deployment.Current.Dispatcher.BeginInvoke(() =>
{
MessageBox.Show(message, title, MessageBoxButton.OKCancel);
});
我想获得用户的选择,我该怎么做?非常感谢!
感谢JaredPar传递回呼。我使用SycnInvokeHelper将其转换为同步呼叫。 – codewarrior
内部类SyncInvokeHelper { 公共无效调用() { 如果(this.dispatcher.CheckAccess()== TRUE){ this.Execute(); } else { this.dispatcher.BeginInvoke(new ExecuteBody(this.Execute)); } } private void Execute() this.Result = this.execBody.DynamicInvoke(args); (this.Completed!= null) { this.Completed(this);如果(this.Completed!= null) { this.Completed(this); } } } – codewarrior