isee.NET Framework Documentation

PageController Class

This class is derived from System.Web.UI.Page, and exposes additional page events that help code-behind for an ASPX manage the flow of the simulation. Each ASPX page in an isee.NET Framework ASP.NET Application should inherit from this class

For a list of all members of this type, see PageController Members.

System.Object
   System.Web.UI.Control
      System.Web.UI.TemplateControl
         System.Web.UI.Page
            iseesystems.iseeNET.Controllers.ASPNET.PageController

[Visual Basic]
<DesignerCategory(Category:="ASPXCodeBehind"), _  Designer(DesignerBaseTypeName:="System.ComponentModel.Design.IRootDesigner, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", DesignerTypeName:="Microsoft.VSDesigner.WebForms.WebFormDesigner, Microsoft.VSDesigner, Version=7.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), _  DefaultEvent(Name:="Load"), _  RootDesignerSerializer(Reloadable:=True, SerializerTypeName:="Microsoft.VSDesigner.WebForms.RootCodeDomSerializer, Microsoft.VSDesigner, Version=7.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", SerializerBaseTypeName:="System.ComponentModel.Design.Serialization.CodeDomSerializer, System.Design, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), _  ToolboxItem(ToolboxItemType:=null), _  DesignerSerializer(SerializerTypeName:="Microsoft.VSDesigner.WebForms.ControlCodeDomSerializer, Microsoft.VSDesigner, Version=7.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", SerializerBaseTypeName:="System.ComponentModel.Design.Serialization.CodeDomSerializer, System.Design, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), _  ToolboxItemFilter(FilterString:="System.Web.UI", FilterType:=ToolboxItemFilterType.Require), _  DefaultProperty(Name:="ID"), _  Designer(DesignerBaseTypeName:="System.ComponentModel.Design.IDesigner", DesignerTypeName:="System.Web.UI.Design.ControlDesigner, System.Design, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")>
Public Class PageController
    Inherits Page
[C#]
[DesignerCategory(Category="ASPXCodeBehind")]
[Designer(DesignerBaseTypeName="System.ComponentModel.Design.IRootDesigner, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", DesignerTypeName="Microsoft.VSDesigner.WebForms.WebFormDesigner, Microsoft.VSDesigner, Version=7.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
[DefaultEvent(Name="Load")]
[RootDesignerSerializer(Reloadable=True, SerializerTypeName="Microsoft.VSDesigner.WebForms.RootCodeDomSerializer, Microsoft.VSDesigner, Version=7.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", SerializerBaseTypeName="System.ComponentModel.Design.Serialization.CodeDomSerializer, System.Design, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
[ToolboxItem(ToolboxItemType=null)]
[DesignerSerializer(SerializerTypeName="Microsoft.VSDesigner.WebForms.ControlCodeDomSerializer, Microsoft.VSDesigner, Version=7.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", SerializerBaseTypeName="System.ComponentModel.Design.Serialization.CodeDomSerializer, System.Design, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
[ToolboxItemFilter(FilterString="System.Web.UI", FilterType=ToolboxItemFilterType.Require)]
[DefaultProperty(Name="ID")]
[Designer(DesignerBaseTypeName="System.ComponentModel.Design.IDesigner", DesignerTypeName="System.Web.UI.Design.ControlDesigner, System.Design, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public class PageController : Page

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

The class exposes events that are helpful in managing the flow of the simulation. The order of these events are:

The following events may fire anytime after the Simulation has been advanced: The code-behind for any ASPX page that inherits from this class can handle these events in addition to the normal page events.

Example

C# Example

protected Knob initElkKnob;
...
override protected void OnInit(EventArgs e)
{
    //
    // CODEGEN: This call is required by the ASP.NET Web Form Designer.
    //
    InitializeComponent();
    base.OnInit(e);

    //Wire the event handlers
    this.InitSimulationObjects += new InitSimulationObjectsDelegate(Setup_InitSimulationObjects);
    this.UpdateControls += new UpdateControlsDelegate(Setup_UpdateControls);
    this.UpdateInputValues += new UpdateInputValuesDelegate(Setup_UpdateInputValues);
}
...
private void Setup_InitSimulationObjects()
{
    this.initElkKnob = this.Simulation.GetKnob("initial_number_of_elk");
}
private void Setup_UpdateInputValues()
{
    this.initElkKnob.CurrentValue = Convert.ToDouble(this.ddlInitalElk.SelectedValue);
}
private void Setup_UpdateControls()
{
    //Let's bind the drop down list to the values of the input object.
    //The input object in this case is a Knob, so let's get it:
    ListItem listItem ; 

    //Let's populate the drop down list values for the list by looping from Min to Max and stepping by Increment
    for(double i=this.initElkKnob.Min; i<=initElkKnob.Max; i+=initElkKnob.Increment)
    {
        listItem = new ListItem(i.ToString());

        //Check if the value we are adding is the current value of the model entity
        //and if it is, make it the selected item in the list
        if(i == initElkKnob.CurrentValue)
        {
            listItem.Selected = true;
        }

        //Add the value to the list
        this.ddlInitalElk.Items.Add(listItem);
    }

    //If we are past start time, then disable as this is an initial value
    if(this.Simulation.CurrentTime > this.Simulation.TimeSpecs.StartTime)
    {
        this.ddlInitalElk.Enabled = false;
    }
}
VB.NET Example (Note in VB.NET you can use drop down lists in the top of the VS.NET IDE to auto-create the event handlers)
Protected initElkKnob As iseeNET.Knob
...
Private Sub Page_InitSimulationObjects() Handles MyBase.InitSimulationObjects
    Me.initElkKnob = Me.Simulation.GetKnob("initial_number_of_elk")
End Sub
Private Sub Page_UpdateInputValues() Handles MyBase.UpdateInputValues
    'Get the selected value from the elk drop down
    Me.initElkKnob.CurrentValue = Convert.ToDouble(Me.ddlInitalElk.SelectedValue)
End Sub

Private Sub Page_UpdateControls() Handles MyBase.UpdateControls
    'Let's bind the drop down list to the values of the input object in the NetSim XML.
    'The input object in this case is a Knob, so let's get it:
    Dim listItem As ListItem

    'Let's populate the drop down list values for the list by looping from Min to Max and stepping by Increment
    For i As Integer = initElkKnob.Min To initElkKnob.Max Step initElkKnob.Increment

        listItem = New ListItem(CStr(i))

        'Check if the value we are adding is the current value of the model entity
        'and if it is, make it the selected item in the list
        If i = initElkKnob.CurrentValue Then
            listItem.Selected = True
        End If

        'Add the value to the list
        Me.ddlInitalElk.Items.Add(listItem)

    Next

    'If we are past start time, then disable as this is an initial value
    If Me.Simulation.CurrentTime > Me.Simulation.TimeSpecs.StartTime Then
        Me.ddlInitalElk.Enabled = False
    End If
End Sub

Requirements

Namespace: iseesystems.iseeNET.Controllers.ASPNET

Assembly: iseesystems.iseeNET.Controllers.ASPNET (in iseesystems.iseeNET.Controllers.ASPNET.dll)

See Also

PageController Members | iseesystems.iseeNET.Controllers.ASPNET Namespace