Click here to Skip to main content
15,891,473 members
Home / Discussions / WPF
   

WPF

 
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 
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 
Adrian Alexander wrote:
As you just pointed out, making the lamdas into methods would then mean you can
directly call them for testing, so I don't see any problem there.



Why would I want to break a single line of code into a separate method? So your "time saver" technique now requires a ton more work? Every single response I get from the message box, I would need to put into a separate method to test it? I suppose you could just have one method which takes the MessageBoxResult and have all your lambdas call it with the appropriate value. Seems silly though. 3 lambdas + 1 method.

Adrian Alexander wrote:
In fact, those "lambdas" are ICommands like any other in the VM.


Yes, VMs expose ICommands, but not every bit of functionality in the VM is broken out into a separate ICommand. Thats absurd. ICommands are only created when you need to invoke some operation from the UI.

Using your technique, I would need to create 3 separate methods or 3 separate ICommands (if my message box happens to display Ok, Cancel & Retry for example). If I do go ahead and create ICommands, oh boy... now I need 3 separate ICommand fields and the code to new up those ICommands, etc. So much work!!! Smile | :)

Now imagine if my VM displays messages boxes in 15 places and each message box has 2 or 3 buttons. Now I need 30 to 45 separate methods just to handle message box responses!!! OH MY LORD.

Adrian Alexander wrote:
In any case, the technique I suggest could easily be adjusted to work with a
switch statement if you like doing it that way.


A better design then what you have now, but still lacking testability. You would again need to break out all the case statements into separate methods. ServiceLocator has no such requirement.

Adrian Alexander wrote:
I prefer using binding (which everyone uses in the WPF apps anyway) and you're
determined to use a service locator (which I don't see any need to introduce
into my code).


You don't seem to have a clear understanding of the difference between the two.

Actually, I don't even use ServiceLocator in my new apps anymore. I use DI. If you took a survey on CP, you'll find almost everybody uses MEF and/or DI to pass around services.

Look, I'm not against coming up with new things... but you have yet to show how your VM remains testable without breaking out every message box case handling code into a separate method and without adding a lot of work for the developer.

ServiceLocator, DI and MEF have already solved all these problems.
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 
AnswerRe: silverlight Pin
Dean Oliver29-Jan-12 18:30
Dean Oliver29-Jan-12 18:30 
QuestionBasic Silverlight Solution Structure Pin
Kevin Marois29-Jan-12 9:51
professionalKevin Marois29-Jan-12 9:51 

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.