Fork me on GitHub
Blog
The journal that this archive was targeting has been deleted. Please update your configuration.

Entries in Controller (1)

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
        });
    }
}