メインのViewModelとUserLoginViewModelがあります。ユーザービューモデルから、[OK]/[キャンセル]オプションを含むプロンプトを表示する必要があります。このリンク http://www.deanchalk.me.uk/post/WPF-MVVM-e28093-Simple-e28098MessageBoxShowe28099-With-Action-Func.aspxに記載されているように実行しました。無効なクロススレッドの例外を回避するために、ディスパッチャーを使用しました。コードはこのようなものです
mainDispatcher.BeginInvoke(new MessageBoxDelegate
(
(message, title) => { Popup(msg, ""); }
), messageArgs);
where mainDispatcher is the dispatcher of MainView and Popup is of type Func<string, string, MessageBoxResult>
And it works fine. The problem is that I cannot get the results from the BeginInvoke
Method. Is there is any way to get the result from the BeginInvoke
method?
If is there is not, any suggestions how i can implement this?