Messenger and MessageBox.Show acts weird

Aug 1, 2011 at 11:50 AM

Hi all,

In my ViewModel I have this code:

 var message = new DialogMessage("Dit artikel is al verkocht", DialogMessageCallback)
                {
                    Button = MessageBoxButton.OK,
                    Caption = "Continue?"
                };

                Messenger.Default.Send(message);

And in my MainWindow.xaml.cs:

InitializeComponent();
            Messenger.Default.Register<DialogMessage>(
               this,
               msg =>
               {
                   var result = MessageBox.Show(
                       msg.Content,
                       msg.Caption,
                       msg.Button);

                   // Send callback
                   msg.ProcessCallback(result);
               });

I copy this code from a example.

Problem: When I send the message it always receives it but the Messagebox is only showing once. When I send it again it enters the code of the Messagebox but I don't see the Messagebox but when I check the result it's still saying OK. So he remembered the result of the previeus Messagebox...

 

Any help?