M
M
Maxim2017-04-08 16:58:04
.NET
Maxim, 2017-04-08 16:58:04

How to create an MVP entry point?

The dependence between the MVP modules, or rather between View and Presenter, is not clear.
Where and how to organize an entry point? In the "main" form?
How to link these 2 modules?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
vvovas, 2017-04-08
@Got_Oxidus

There are different options. For example, I use the following approach:
1. There is a view that does not know about anything. Can only display data. Usually has an interface describing all the properties that can be displayed in this view.
2. There is a presenter that knows about IView (view interface) and uses it to pass data for display.
3. Reverse transmission of information, i.e. the reaction to something that happens on the form is carried out through events. Those. view throws an event and it doesn't matter who catches it. Presenter listens for events and does something with the model, and then passes new data through the interface back to the view, if necessary.
As for the entry point, in my version a view is created and a presenter to which this view is passed. view is placed on the form and that's it. When the view was passed to the presenter, it filled it with data and subscribed to events.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question