Search the web
Sign In
New User? Sign Up
altdotnet · Alt Dot.Net Discussions
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Real people. Real stories. See how Yahoo! Groups impacts members worldwide.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Prism V2 with MVVM. How best to use MessageBox.Show()?   Topic List   < Prev Topic  |  Next Topic >
Reply | Forward  | 
Re: [altdotnet] Re: Prism V2 with MVVM. How best to use MessageBox.Show()?

Actually another way of doing it which is equally testable is to use EventAggregator. You could fire an event for ShowMessage() coming from the ViewModel which is handled by the view, or the controller. You could also then either synchronously return the Yes/No/Cancel state by making it a property on the parameters that you pass to the EA event, or you could  asynchronously raise a separate event to indicate selection which the VM subscribes to.

Glenn




On Sat, Feb 7, 2009 at 11:33 AM, Staxxx <staxxx@...> wrote:

Thanks Glen, just wanted to make sure I wasn't missing something better... :)



On Sat, Feb 7, 2009 at 11:09 AM, glenn_block <glenn.block@...> wrote:

--- In altdotnet@yahoogroups.com, Staxxx <staxxx@...> wrote:
>
> Hello all,
> I posted this discussion at
> http://www.codeplex.com/CompositeWPF/Thread/View.aspx?ThreadId=46353
without
> any response in a couple days I thought I would see what everyone
here has
> any thoughts about this.
> Any input would be appreciated.
>
> Thanks,
> Jason Jarrett
>

Hi Jason

I replied on the thread.





Sat Feb 7, 2009 9:33 pm

glenn_block
Offline Offline
Send Email Send Email

Forward
 | 
Expand Messages Author Sort by Date

Hello all, I posted this discussion at http://www.codeplex.com/CompositeWPF/Thread/View.aspx?ThreadId=46353 without any response in a couple days I thought I...
Staxxx
jason.jarrett
Offline Send Email
Feb 7, 2009
6:26 pm

... without ... here has ... Hi Jason I replied on the thread....
glenn_block
Offline Send Email
Feb 7, 2009
7:09 pm

Thanks Glen, just wanted to make sure I wasn't missing something better......
Staxxx
jason.jarrett
Offline Send Email
Feb 7, 2009
7:33 pm

Actually another way of doing it which is equally testable is to use EventAggregator. You could fire an event for ShowMessage() coming from the ViewModel which...
Glenn Block
glenn_block
Offline Send Email
Feb 7, 2009
9:33 pm

True, that would be another way. However I still like the easy readibility of the synchronous IMessageBoxService.Show(). And since we now have mocking...
Staxxx
jason.jarrett
Offline Send Email
Feb 7, 2009
10:31 pm

Likewise, posted to the discussion. From: altdotnet@yahoogroups.com [mailto:altdotnet@yahoogroups.com] On Behalf Of glenn_block Sent: Saturday, February 07,...
Brian Noyes
briandnoyes
Offline Send Email
Feb 8, 2009
11:56 am

I am not sure which place better - codeplex or here... I do not like coupling of the concrete implementation of the message box to ether Model or Presenter....
Mike Chaliy
mike_chaliy
Offline Send Email
Feb 8, 2009
3:45 pm

I have explored using this approach in the past, however the downside is you have to actually reset the boolean property for displaying the message box to be...
Glenn Block
glenn_block
Offline Send Email
Feb 8, 2009
7:04 pm

In my case, I wrote reset code just once. And really code do not so complex. Just Model.IsMessageBoxOpened = false wrapped in Command (this is how all actions...
Mike Chaliy
mike_chaliy
Offline Send Email
Feb 8, 2009
7:40 pm

I do hear your point, and went down this path initially. However I don't agree that it is making life simpler, especially when you add in yes/no/cancel. You...
Glenn Block
glenn_block
Offline Send Email
Feb 8, 2009
8:13 pm

... In opposite, I cannot agree that solution with property is complex. Please review the following code. This some-what-over-complicated, but this is...
Mike Chaliy
mike_chaliy
Offline Send Email
Feb 8, 2009
9:57 pm

From: altdotnet@yahoogroups.com [mailto:altdotnet@yahoogroups.com] On Behalf Of Mike Chaliy Sent: Sunday, February 08, 2009 1:57 PM To:...
Glenn Block
glenn_block
Offline Send Email
Feb 9, 2009
2:25 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help