I am trying to understand how to implement MVC in winforms so I have put together the following;
- A main form which is divided into 2 panes (left/right) the left pane will display a list of customers.
- An order details form which will list all the orders placed for the selected customer on the main form.This order details form will be displayed in the right pane of the main form.
Now, I have defined a view interface for each and a presenter. How should the order details presenter get a hold of the selected customer in the other view?
You need a publish and subscribe mechanism.
Each view can announce its state changes (selectionchange event for example).
Interested components can subscribe to those events.
This decouples the two views – it means you could have a additional panes that shows the web page of the customer, graph of order history, photo of salesman…