Here's a quick overview of my code, which is a moderately complex WinForms GUI.
A dependency context is a template for representing a model view.
public class StatSyncherFormView : Form, IView
{ ... }
public class Presenter
{
public readonly IView view;
public Presenter(IView view)
{
this.view = view;
}
}
static void Main()
{
IView view = new View();
Presenter presenter = new Presenter(view);
Application.Run((Form)p.view);
}
1) I like the fact that the view is set only by the constructor and will not be changed after it. It makes me feel better in the context of multi-threaded GUI development.
2) With public View {get; private set;}I lose (immutability?).
3) private readonly IView viewI also need public View {get {return view;}}one that feels (at least maybe someone can tell me otherwise) redundant.
: , (3) - , .
, , , , .