/// <summary> /// Initializes a new instance of the <see cref="ExecController"/> class. The caller may specify userData. /// <br></br>Frame rate must be from zero to 25. If zero, no contraint is imposed. /// </summary> /// <param name="exec">The executive being controlled.</param> /// <param name="scale">The (logarithmic) run time scale. If set to double.MinValue, the model runs at full speed.</param> /// <param name="frameRate">The frame rate in render events per second. If zero, execution is unconstrained.</param> /// <param name="userData">The user data.</param> public ExecController(IExecutive exec, double scale, int frameRate, object userData) { if (!Disable) { m_userData = userData; m_executive = exec; m_executive.ExecutiveStarted += m_executive_ExecutiveStarted; Scale = scale; FrameRate = frameRate; m_kickoffManager = new KickoffMgr(this, m_executive); m_doThrottle = ThrottleExecution; } }
/// <summary> /// Sets the executive on which this controller will operate. This API should only be called once. The /// ExecController cannot be targeted to control a different executive. /// </summary> /// <param name="exec">The executive on which this controller will operate.</param> public void SetExecutive(IExecutive exec) { if (m_executive == exec) { return; } if (m_executive != null) { throw new InvalidOperationException("Calling SetExecutive on an ExecController that's already attached to a different executive is illegal."); } m_executive = exec; m_executive.ExecutiveStarted += m_executive_ExecutiveStarted; m_kickoffManager = new KickoffMgr(this, m_executive); }