Click here to Skip to main content
15,894,955 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: Focusing on elements in MVVM Pin
SledgeHammer0131-Jan-12 7:21
SledgeHammer0131-Jan-12 7:21 
GeneralRe: Focusing on elements in MVVM Pin
mi_n31-Jan-12 9:36
mi_n31-Jan-12 9:36 
QuestionWPF Dialog Service via Binding Pin
Adrian Alexander29-Jan-12 23:18
Adrian Alexander29-Jan-12 23:18 
AnswerRe: WPF Dialog Service via Binding Pin
SledgeHammer0130-Jan-12 5:11
SledgeHammer0130-Jan-12 5:11 
GeneralRe: WPF Dialog Service via Binding Pin
Adrian Alexander30-Jan-12 5:14
Adrian Alexander30-Jan-12 5:14 
GeneralRe: WPF Dialog Service via Binding Pin
SledgeHammer0130-Jan-12 5:20
SledgeHammer0130-Jan-12 5:20 
GeneralRe: WPF Dialog Service via Binding Pin
Adrian Alexander30-Jan-12 5:24
Adrian Alexander30-Jan-12 5:24 
GeneralRe: WPF Dialog Service via Binding Pin
SledgeHammer0130-Jan-12 6:45
SledgeHammer0130-Jan-12 6:45 
Adrian Alexander wrote:

The view doesn't exist during unit testing.


Correct. So guess what happens during testing? *Nothing*. In your sample code, you set Message to your DialogPM object and the message box gets shown by the view that is bound to it. During testing, there is no view, so nothing happens. None of the code in the lamdas is tested.

Anyways, just a personal opinion, but the more I look at this, the more I don't like it. Seems like a lot more work then the service locator:

1) you have to add the MessageBoxHelper to your view xaml
2) you have to add a bindable / public DialogPM property to your VM
3) you can't use the lambdas inline because they are untestable as mentioned above and you would need to break them out into seperate methods and test them separately (not very cool if you only need a one or two line code block!)

I don't see how this is any easier or better then:

C#
MessageBoxButtons result = ViewModelBase.GetService<IDialogService>().ShowMessageBox(...);

switch (result)
{
}


???

modified 30-Jan-12 12:57pm.

GeneralRe: WPF Dialog Service via Binding Pin
Adrian Alexander30-Jan-12 8:01
Adrian Alexander30-Jan-12 8:01 
GeneralRe: WPF Dialog Service via Binding Pin
SledgeHammer0130-Jan-12 8:28
SledgeHammer0130-Jan-12 8:28 
GeneralRe: WPF Dialog Service via Binding Pin
Adrian Alexander30-Jan-12 9:22
Adrian Alexander30-Jan-12 9:22 
GeneralRe: WPF Dialog Service via Binding Pin
SledgeHammer0130-Jan-12 10:43
SledgeHammer0130-Jan-12 10:43 
GeneralRe: WPF Dialog Service via Binding Pin
Adrian Alexander30-Jan-12 14:28
Adrian Alexander30-Jan-12 14:28 
AnswerRe: WPF Dialog Service via Binding Pin
SledgeHammer0130-Jan-12 14:54
SledgeHammer0130-Jan-12 14:54 
GeneralRe: WPF Dialog Service via Binding Pin
Pete O'Hanlon30-Jan-12 23:06
mvePete O'Hanlon30-Jan-12 23:06 
GeneralRe: WPF Dialog Service via Binding Pin
Adrian Alexander6-Feb-12 19:45
Adrian Alexander6-Feb-12 19:45 
GeneralRe: WPF Dialog Service via Binding Pin
Mycroft Holmes30-Jan-12 13:20
professionalMycroft Holmes30-Jan-12 13:20 
GeneralRe: WPF Dialog Service via Binding Pin
SledgeHammer0130-Jan-12 13:32
SledgeHammer0130-Jan-12 13:32 
AnswerRe: WPF Dialog Service via Binding Pin
Pete O'Hanlon30-Jan-12 5:48
mvePete O'Hanlon30-Jan-12 5:48 
GeneralRe: WPF Dialog Service via Binding Pin
Adrian Alexander30-Jan-12 5:49
Adrian Alexander30-Jan-12 5:49 
Questionerror SocketError.AccessDenied on silverlight Pin
ptcnbaoduong29-Jan-12 15:17
ptcnbaoduong29-Jan-12 15:17 
AnswerRe: error SocketError.AccessDenied on silverlight Pin
Mycroft Holmes29-Jan-12 16:40
professionalMycroft Holmes29-Jan-12 16:40 
AnswerRe: error SocketError.AccessDenied on silverlight Pin
Dean Oliver29-Jan-12 18:34
Dean Oliver29-Jan-12 18:34 
AnswerRe: error SocketError.AccessDenied on silverlight Pin
Abhinav S29-Jan-12 18:54
Abhinav S29-Jan-12 18:54 
Questionsilverlight Pin
ptcnbaoduong29-Jan-12 15:16
ptcnbaoduong29-Jan-12 15:16 

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.