events revisited

M

mp

i got this quote from somewhere, don't know where
I don't think it was from my recent posts re events?

just curious if there's comments on this:
//Any events in the form, you pass control to a like event in the

//presenter for the control.

//private button1_click()

//{

// presenter.button1_click() // passing what parms and objects form

//the signature of the button click



thanks

mark
 
M

mp

Peter Duniho said:

how the heck did you find that?
:)
i couldn't pull it up from advanced group search?!
The original author can clarify for you. But I don't think that the
suggested syntax makes sense. The view shouldn't have any need to know a
specific method name in the presenter. For that matter, assuming a
well-designed IView interface, I don't think it needs to know the
presenter type at all.

Instead, the IView interface can declare an event that mirrors the
control's event, and then the presenter can subscribe to that event.

So the event handler in the view class would look more like:

private void button1_Click(object sender, EventArgs e)
{
EventHandler handler = Click;

if (handler != null)
{
handler(this, e);
}
}

(where "Click" is the event that the view type implements to satisfy the
declared IView.Click event:

interface IView
{
event EventHandler Click;
}

In other words, the IView interface will simply forward (simplifying and
abstracting as feasible, so that the IView interface is not depending on
the specific UI API being used) the features found in the user interface.

Pete

I thought it looked much different than all the event syntax we've gone
through recently
<g>
i've saved so many notes from here there and everywhere i sometimes forget
where they come from
thanks
mark
 
M

mp

Peter Duniho said:
Google Groups search sucks. I have no idea why, but at least half the
time, it claims "no results found" even when I know for a fact the thing
I'm searching for is in there.

It was easy to find using Google's normal web search though.

back when i was haunting the autocad groups, I used to have pretty good luck
with ggas, not so much lately
 
J

Jeff Johnson

back when i was haunting the autocad groups, I used to have pretty good
luck
with ggas, not so much lately

Google Groups search went south two or three years ago, maybe more. It used
to rock hard. Those were the days....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top