Using windowsform: Winforms MVP with Castle Windsor – DI for subforms? on newest questions tagged winforms – Stack Overflow
I’m building a winforms app utilizing passive-view MVP and Castle Windsor as an IoC container. I’m still a little new to dependency injection and MVP, so I’m looking for some clarity…
I have a main form which contains a number of user controls, and also will bring up other dialogs (ex. Login, options, etc) as needed. My first question is…should I use constructor injection to get the presenters for these other views into the main view, or should I go back to a Service Locator-type pattern? (which I’ve been told is a big nono!) Or something else?
Second question…the user controls need to communicate back to the main form when they are “completed” (definition of that state varies based on the control). Is there a standard way of hooking these up? I was thinking perhaps just wiring up events between the main presenter and the child presenters, but I’m not sure if this is proper thinking.
I’d appreciate any help, it seems that the combination of MVP and IoC in winforms isn’t exactly well-documented.
Using windowsform: using-windowsform