S
Steve K.
I'm using Model View Presenter for my UI, I like to structure it introduces
and it tends to make me "do the right thing"
One problem I'm having is making the distinction between what I can and
can't do in the View code. For example if a user modifies a value in the
View and I want to change an icon somewhere on the View is it good form to
handle that change in the View code or should I do something like:
<Value in View field changes>
this._icon.Image = _presenter.GetImageForItem(item);
Basically, shoud I run all changes through the presenter?
Another question:
I have a View with many fields (20+). When I finally want to save the data
by giving it to the Presenter for instinct is to instantiate one of my
Business Objects, set all the properties then send this instance to the
Presenter. It's just *feels* cleaner, but I think I'm breaking MVP by using
a Model instance in the View, no?
The alternative would be a method like this:
_presenter.SavePatient(string fName, string mInitial, string lName,
string address1, string address2, int cityId, int stateId, string
zipCode,
string physicianFName, string physicianMInitial, string physicianLName,
string physicianAddress1, string physicianAddress2, int physicianCityId,
int physicianStateId, string physicianZipCode, etc, etc, etc);
That makes mt stomach turn! ;0)
But.... it might be proper MVP, I don't know. What do you all think?
-Steve
and it tends to make me "do the right thing"
One problem I'm having is making the distinction between what I can and
can't do in the View code. For example if a user modifies a value in the
View and I want to change an icon somewhere on the View is it good form to
handle that change in the View code or should I do something like:
<Value in View field changes>
this._icon.Image = _presenter.GetImageForItem(item);
Basically, shoud I run all changes through the presenter?
Another question:
I have a View with many fields (20+). When I finally want to save the data
by giving it to the Presenter for instinct is to instantiate one of my
Business Objects, set all the properties then send this instance to the
Presenter. It's just *feels* cleaner, but I think I'm breaking MVP by using
a Model instance in the View, no?
The alternative would be a method like this:
_presenter.SavePatient(string fName, string mInitial, string lName,
string address1, string address2, int cityId, int stateId, string
zipCode,
string physicianFName, string physicianMInitial, string physicianLName,
string physicianAddress1, string physicianAddress2, int physicianCityId,
int physicianStateId, string physicianZipCode, etc, etc, etc);
That makes mt stomach turn! ;0)
But.... it might be proper MVP, I don't know. What do you all think?
-Steve