M
mp
back to the view/presenter/business project
...just tell me when you all are sick of my stupid beginner
box-of-rocks-for-a-brain questions
trying to experiment with the "push/pull" topic Peter brought up
i had this exchange with Peter recently on another thread.,..
me:
peter:
That all seems fine.
so i went to try and implement
what i forgot to mention is what happens before #1 above
A. User clicks button
B. Button raises event
C.Presenter catches event and raises it's own event so Portfolio.cs can
catch that event - causing it to go get data
that's what triggers #1 above.
so for presenter to raise an event that business object catches, business
obj has to have reference to presenter
so far how i know to raise/catch events is to have a refernce to the
'raising' object in the 'catching' object
for example for my view to talk to my presenter...in my presenter i have a
reference to my view
private IInvestmentsView mView;
in presenter subscribe to view event
this.mView.LoadInvestments += new
EventHandler<EventArgs>(mView_LoadInvestments);
so i thought for the business object to subscribe to a presenter event (go
get property) the business object needs a reference to the presenter
and for the presenter to subscribe to an event from the business object
(property_changed) the presenter needs a reference to the business object
when i try to do that i get a circular reference error
is there another way to subscribe to events that don't require a reference
to the object?
can you not have two-way events?
object1 raises event "call"
object2 catches event "call"
object2 raises event"response"
object1 catches event "response"
???
thanks
mark
...just tell me when you all are sick of my stupid beginner
box-of-rocks-for-a-brain questions
trying to experiment with the "push/pull" topic Peter brought up
i had this exchange with Peter recently on another thread.,..
me:
1 my business object Portfolio.cs gets a string from somewhere that it
wants
to display
2 it raises an event GotStringToDisplay(string str) (or whatever better
name) when it has it...
3 the presenter InvestmentPresenter.cs (another badly named object i know)
subscribes to that event
and raises it's own event GotStringToDisplay(string str)
4 the view(form) InvestmentView.cs subscribes to that event and fills it's
datagrid (or whatever other control) with the string???
am i even close???
peter:
That all seems fine.
so i went to try and implement
what i forgot to mention is what happens before #1 above
A. User clicks button
B. Button raises event
C.Presenter catches event and raises it's own event so Portfolio.cs can
catch that event - causing it to go get data
that's what triggers #1 above.
so for presenter to raise an event that business object catches, business
obj has to have reference to presenter
so far how i know to raise/catch events is to have a refernce to the
'raising' object in the 'catching' object
for example for my view to talk to my presenter...in my presenter i have a
reference to my view
private IInvestmentsView mView;
in presenter subscribe to view event
this.mView.LoadInvestments += new
EventHandler<EventArgs>(mView_LoadInvestments);
so i thought for the business object to subscribe to a presenter event (go
get property) the business object needs a reference to the presenter
and for the presenter to subscribe to an event from the business object
(property_changed) the presenter needs a reference to the business object
when i try to do that i get a circular reference error
is there another way to subscribe to events that don't require a reference
to the object?
can you not have two-way events?
object1 raises event "call"
object2 catches event "call"
object2 raises event"response"
object1 catches event "response"
???
thanks
mark