I want to follow good practices design patterns when developing WinForms applications.
I have a UserControl with a button "Add" to open a new Form where de user can search Employees. How i can organize my code?
I want to follow good practices design patterns when developing WinForms applications.
I have a UserControl with a button "Add" to open a new Form where de user can search Employees. How i can organize my code?
If you use WinForms you should use MVP (Model-View-Presenter) design pattern. In this case each view has own
ISomethingView
which contains the properties and the events, for example:And now your UserControl must implemented this interface.
Also for each view you have to create a presenter which is responsible for communication between the view and a business logic:
You can use DI container to resolve all
I*Vies
, for example: