Fork me on GitHub
Blog
The journal that this archive was targeting has been deleted. Please update your configuration.
« Container | Main | Behavior Event »
Wednesday
Oct102012

Controller

A Controller (C) is the center of the pattern where all Behavior Events sent by different Views are catched, processed and translated into Transition Events. A controller can determine the concrete Behavior referenced from a Behavior Event and executes the Behavior and if the Behavior is bound to a View then it would transition the current View to the bound View.

public partial class Controller
{
    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);
        if (this.Page.IsPostBack) return;
        
        //first behavior event of your application
        //that would open the home (default) view
        this.FireBehaviorEvent(
            new BehaviorEvent<StudentViewModel>()
        {
            BehaviorReference = BehaviorReference.OpenHomeBehavior
        });
    }
}

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>