Fork me on GitHub
Blog
The journal that this archive was targeting has been deleted. Please update your configuration.
« Controller | Main | Behavior »
Tuesday
Oct092012

Behavior Event

A Behavior Event (BE) is an application level event fired by Views. Views basically catch their own internal events and accordingly translate it to the appropriate application level event by wrapping a View Model (VM) and a Behavior Reference into a single Behavior Event (BE) object and then sending it to the Controller. The Controller would translate the Behavior Reference to an actual concrete Behavior to be executed against the View Model wrapped inside the Behavior Event. A Behavior Event enables Views to communicate to the Controller by isolating the concrete behaviors from the views and isolating internal view events from the rest of the application.

//from JUIPP core
public class BehaviorEvent<T> where T : IViewModel, new()
{
    public T ViewModel { get; set; }
    public string BehaviorReference { get; set; }
}
//from StudentProfileView view
protected void ButtonOpenStudentProfileClick(object sender, EventArgs e)
{
    //..translate a [button click event] to a [behavior event]..
    //..and fire (or send) the behavior event that would eventually
    //..open the StudentProfileView view
    this.SendBehaviorEvent(
      new BehaviorEvent<StudentViewModel>()
      {
          BehaviorReference = BehaviorReference.OpenStudentProfileBehavior,
          ViewModel = new StudentViewModel()
                          {
                              Id = "0001"
                          }
      });
}

References (1)

References allow you to track sources for this article, as well as articles that were written in response to this article.

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>