2013-03-28 5 views
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); 
      }); 

나는 무엇을해야 하나? 고마워요!

답변

4

가장 좋은 방법은이 결과

Deployment.Current.Dispatcher.BeginInvoke(() => { 
    var result = MessageBox.Show(message, title, MessageBoxButton.OKCancel); 
    OnMessageBoxComplete(result); 
}); 

void OnMessageBoxComplete(MessageBoxResult result) { 
    ... 
} 
+0

감사 JaredPar 함께 전달하는 전화 등을 사용하는 것입니다 것입니다. SycnInvokeHelper를 사용하여이를 동기화 호출로 변환했습니다. – codewarrior

+0

내부 클래스 SyncInvokeHelper { 공개 무효()를 호출 { 경우 (this.dispatcher.CheckAccess() == TRUE) { this.Execute(); } else { this.dispatcher.BeginInvoke (new ExecuteBody (this.Execute)); } } private void Execute() { this.Result = this.execBody.DynamicInvoke (args); if (this.Completed! = null) { this.Completed (this); } } } – codewarrior