Click here to Skip to main content
15,897,518 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: background worker Pin
Tesic Goran16-Feb-11 3:50
professionalTesic Goran16-Feb-11 3:50 
GeneralRe: background worker Pin
Ian Shlasko16-Feb-11 5:29
Ian Shlasko16-Feb-11 5:29 
GeneralRe: background worker Pin
Tesic Goran16-Feb-11 21:37
professionalTesic Goran16-Feb-11 21:37 
GeneralRe: background worker Pin
Pete O'Hanlon16-Feb-11 21:52
mvePete O'Hanlon16-Feb-11 21:52 
GeneralRe: background worker Pin
Pete O'Hanlon16-Feb-11 7:38
mvePete O'Hanlon16-Feb-11 7:38 
GeneralRe: background worker Pin
Tesic Goran16-Feb-11 21:24
professionalTesic Goran16-Feb-11 21:24 
GeneralRe: background worker Pin
Pete O'Hanlon16-Feb-11 21:50
mvePete O'Hanlon16-Feb-11 21:50 
QuestionMVVM Question Pin
_Maxxx_14-Feb-11 0:14
professional_Maxxx_14-Feb-11 0:14 
Again, not specifically WPF but ...

Most of the MVVM frameworks implement some sort of Messaging pattern to allow ViewModels to communicate.

Say VM1 selects a customer, it sends a "Customer Selected" message and VM2 responds to that message by displaying that customer's details.

All (that I have looked at) use a singleton Messenger object (the name varies) to which every VM has access and can subscribe to Messages or send messages.

And it all works fine and dandy.

Here's the bit I don't understand.

would it not be just as easy (if not easier) to use events? Isn't this just what the messenger is duplication?

So VM1 selects a customer and tells an "Eventor" singleton to raise the "Customer Selected" event. VM2 has subscribed to this event, and so displays that customer's details when it is raised.

I feel sure that there's a good reason for not doing this, but I'm stuffed if I can think what it is?

(Just to show I'm not a complete doofus, I am aware that most Messenger implementations avoid potential memory leaks by using WeakReferences, which may be an advantage - but is that the only reason for using it?)

Thanks
___________________________________________
.\\axxx
(That's an 'M')

AnswerRe: MVVM Question Pin
Pete O'Hanlon14-Feb-11 0:22
mvePete O'Hanlon14-Feb-11 0:22 
GeneralRe: MVVM Question Pin
_Maxxx_14-Feb-11 0:37
professional_Maxxx_14-Feb-11 0:37 
GeneralRe: MVVM Question Pin
Pete O'Hanlon14-Feb-11 0:42
mvePete O'Hanlon14-Feb-11 0:42 
GeneralRe: MVVM Question Pin
_Maxxx_14-Feb-11 13:51
professional_Maxxx_14-Feb-11 13:51 
AnswerRe: MVVM Question Pin
lmoelleb14-Feb-11 1:47
lmoelleb14-Feb-11 1:47 
GeneralRe: MVVM Question Pin
Pete O'Hanlon14-Feb-11 5:13
mvePete O'Hanlon14-Feb-11 5:13 
GeneralRe: MVVM Question Pin
Mycroft Holmes14-Feb-11 13:36
professionalMycroft Holmes14-Feb-11 13:36 
GeneralRe: MVVM Question Pin
_Maxxx_14-Feb-11 13:58
professional_Maxxx_14-Feb-11 13:58 
GeneralRe: MVVM Question Pin
Mycroft Holmes14-Feb-11 14:06
professionalMycroft Holmes14-Feb-11 14:06 
AnswerRe: MVVM Question Pin
SledgeHammer0114-Feb-11 15:03
SledgeHammer0114-Feb-11 15:03 
GeneralRe: MVVM Question Pin
_Maxxx_14-Feb-11 17:03
professional_Maxxx_14-Feb-11 17:03 
GeneralRe: MVVM Question Pin
SledgeHammer0114-Feb-11 19:27
SledgeHammer0114-Feb-11 19:27 
GeneralRe: MVVM Question Pin
_Maxxx_14-Feb-11 23:19
professional_Maxxx_14-Feb-11 23:19 
GeneralRe: MVVM Question Pin
Pete O'Hanlon14-Feb-11 22:19
mvePete O'Hanlon14-Feb-11 22:19 
AnswerRe: MVVM Question Pin
Abhinav S14-Feb-11 18:21
Abhinav S14-Feb-11 18:21 
GeneralRe: MVVM Question Pin
_Maxxx_14-Feb-11 18:55
professional_Maxxx_14-Feb-11 18:55 
GeneralRe: MVVM Question [modified] Pin
SledgeHammer0115-Feb-11 7:31
SledgeHammer0115-Feb-11 7:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.