Как структурировать программу C # WinForms Model-View-Presenter (пассивное представление)?

I am designing a GUI that has the following basic idea (similarly modeled after Visual Studio's basic look-and-feel):

  1. File navigation
  2. Control selector (for selecting what to display in the Editor component)
  3. Editor
  4. Logger (errors, warnings, confirmation, etc.)

For now, I will be using a TreeView for file navigation, a ListView for selecting controls to be displayed in the Editor and a RichTextBox for the Logger. The Editor will have 2 types of editing modes depending on what is selected in the TreeView. The Editor will either be a RichTextBox for manually editing text inside files, or it will be a Panel with Drag/Drop DataGridViews and sub-TextBoxes for editing in this Panel.

I am attempting to follow the Passive View design pattern for complete separation of Model from View and vice versa. The nature of this project is that any component I add is subject to edit/removal. As such, I need there to independence from a given control to the next. If today I am using a TreeView for file navigation, but tomorrow I am told to use something else, then I want to implement a new control with relative ease.

I simply do not understand how to structure the program. I understand one Presenter per Control, but I do not know how to make it work such that I have a View (the entire GUI of the program) with controls (sub-Views) such that the ENTIRE View is replaceable as well as the individual controls that reflect my model.

In the main View, which is supposed to be lightweight by Passive View standards, do I implement the sub-Views individually? If so, say I have an interface INavigator to abstract the role of the Navigator object. The navigator will need a Presenter and a Model to act between the Navigator View and the main View. I feel like I am getting lost in the design pattern jargon somewhere.

The most similarly-related question can be found here, but it does not answer my question in sufficient detail.

Will anybody please help me understand how to "structure" this program? I appreciate any help.

Thanks,

Daniel

7
задан Community 23 May 2017 в 12:02
поделиться