I am building a view (web form) that will display various messages based on the state of a persons License. There are approximately 10 messages that the user will see. I don't really want to create multiple panels and show/hide and populate form fields based on the state...I would rather set a single property on the page...lets just call it:
public String Message
{
get;
set;
}
The message will include html formatting and some of the messages are much longer than other messages...I guess I am looking for a decent pattern to follow so this will be easily manageable...so my presenter will just return the formatted message based on the state of the licen开发者_Python百科se.
I am thinking I will create a abstract MessageTemplateBaseClass and classes for each message that build the message...The presenter will return the correct instance of the template based on the license state...
Does this sound like a decent approach?
Yes that would work, or potentially define an IKeyMessage interface that has this definition, and each presenter checks if its view defines this interface, casts it, and sets it appropriately.
HTH.
精彩评论