コード例 #1
0
        //-///////////////////////////////////////////////////////////////////////
        //-///////////////////////////////////////////////////////////////////////

        private void TickPython(Graphics g)
        {
            if (_scriptEngine == null)
            {
                return;
            }

            _pydoodleModule.BeginDraw(g, GraphicsPanel.GraphicsControl);

            try
            {
                switch (_scriptState)
                {
                case ScriptState.RunGlobal:
                {
                    _scriptSource.Execute();

                    _scriptState = ScriptState.RunTick;
                }
                break;

                case ScriptState.RunTick:
                {
                    if (_runPyobj != null)
                    {
                        //_textPanel.ClearText();
                        _pydoodleModule.GraphicsControl.ResetHandlesList();

                        _objectOperations.InvokeMember(_runPyobj, "tick");

                        _textPanel.ClearOnNextText = true;
                    }
                }
                break;
                }
            }
            catch (Exception e)
            {
                _scriptException = e;
                _scriptState     = ScriptState.Borked;

                _textPanel.AppendText("Exception: " + e.Message + Environment.NewLine);
                _textPanel.AppendText(Misc.GetScriptExceptionDynamicStackFramesTrace(e));

                _graphicsPanel.GraphicsControl.ResetHandlesList();
            }

            _pydoodleModule.EndDraw();
        }