Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your form is a View, it is not a Presenter. Thus it should implement interface <code>ITestView</code>:</p> <pre><code>public interface ITestView { event EventHandler Load; void LoadList(IEnumerable&lt;AppSignatureDto&gt; data); } </code></pre> <p>And your Presenter is someone, who subscribes to view's events and uses view properties to read and update view:</p> <pre><code>public class TestPresenter { private ITestView view; public TestPresenter(ITestView view) { this.view = view; view.Load += View_Load; } private void View_Load(object sender, EventArgs e) { List&lt;AppSignature&gt; signatures = // get from model List&lt;AppSignatureDto&gt; signatureDtos = // map domain class to dto view.LoadList(signatureDtos); } } </code></pre> <p>And you form, as I already said, is a view, it does not know anything about presenter and model:</p> <pre><code>public partial class TestForm : Form, ITestView { public event EventHandler Load; private void ButtonLoad_Click(object sender, EventArgs e) { if (Load != null) Load(this, EventArgs.Empty); } public void LoadList(IEnumerable&lt;AppSignatureDto&gt; data) { // populate grid view here } } </code></pre> <p>How to deal with reference to domain classes? Usually I provide to view only simple data (strings, integers, dates, etc), or I create data transfer objects, which are passed to view (you can name them FooView, FooDto, etc). You can easily map them with something like <a href="http://automapper.org/" rel="nofollow">AtoMapper</a>:</p> <pre><code>List&lt;AppSignatureDto&gt; signatureDtos = Mapper.Map&lt;List&lt;AppSignature&gt;, List&lt;AppSignatureDto&gt;&gt;(signatures); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload