public void RunScript(Capture.InkInputControl input, ScriptEngine scriptEngine)
 {
     mCognitiveMapControl.InputControl = input;
     mCognitiveMapControl.RunScript(scriptEngine);
 }
        /// <summary>
        /// Configures the preview control given a change to the underlying script instance.
        /// </summary>
        private void Configure()
        {
            _ScriptEngine = new ScriptEngine(_Script.ScriptBody);

            if (_ScriptEngine.Cognitive)
                _Background = Properties.Icons.tablet_cognitive;
            else
                _Background = Properties.Icons.tablet_direct;

            _DirectRegion = GetColorRegion(_Background, Color.Red);
            _CognitiveRegion = GetColorRegion(_Background, Color.Blue);

            mPanelDirect.Location = _DirectRegion.Location;
            mPanelDirect.Size = _DirectRegion.Size;

            mPanelCognitive.Location = _CognitiveRegion.Location;
            mPanelCognitive.Size = _CognitiveRegion.Size;

            Invalidate(true);
        }
        public void RunTest(object state, TestScript script)
        {
            if (TestRunning)    //don't allow a new test to be run while one is already running
                throw new InvalidOperationException("A script is already running.");

            if (_ScriptRenderer != null)    //clean up any existing script renderer
                _ScriptRenderer.Dispose();

            ScriptEngine ScriptEngine = new ScriptEngine(script.ScriptBody);

            //create a new script renderer for this control
            _ScriptRenderer = new TestScriptRenderer(this, ScriptEngine, ScriptEngine.Cognitive);

            if (ScriptEngine.Cognitive)
            {
                _CognitiveDisplay = new CognitiveMapForm();
                _CognitiveDisplay.Show();
                _CognitiveDisplay.RunScript(this, ScriptEngine);

                DrawPressureMode = ScriptEngine.PressureFeedback;
                DrawInk = ScriptEngine.DirectFeedback;
            }
            else /*IsDirect*/
            {
                DrawPressureMode = ScriptEngine.PressureFeedback;
                DrawInk = ScriptEngine.DirectFeedback;
            }

            mLabelInstructions.Text = ScriptEngine.Instructions;

            _CallbackScriptID = script.TestScriptID;
            _CallbackState = state;

            //clear collected samples
            Clear();

            _TestTimeout = ScriptEngine.TimeLimit;
            _TestLastSample = _TestStart = DateTime.UtcNow;
            StartCapture();
        }