Example #1
0
        private void EnableDebuggingControls(bool enabled, bool debuggingStarted)
        {
            if (this.InvokeRequired)
            {
                this.Invoke(new EnableDebuggingControlsHandler(this.EnableDebuggingControls), enabled, debuggingStarted);
            }
            else
            {
                if (CPU != null)
                {
                    CPU.Reset();
                }

                this.bbiDebugNext.Enabled  = false;
                this.bbiDebugPause.Enabled = debuggingStarted && enabled;
                this.bbiDebugStop.Enabled  = debuggingStarted && enabled;
                this.bbiDebugRun.Enabled   = !debuggingStarted && enabled;

                this.codeEditor.ReadOnly = debuggingStarted && enabled;

                if (debuggingStarted)
                {
                    this.ribbonControlMain.SelectedPage = this.ribbonPageDebug;
                    this.registersTool.Enable(this.CPU);
                    this.stackTool.Enable();
                    this.scratchpadTool.Enable(this.CPU);
                }
                else
                {
                    this.ribbonControlMain.SelectedPage = this.ribbonPageFile;
                    this.registersTool.Disable();
                    this.stackTool.Disable();
                    this.scratchpadTool.Disable();
                }
            }
        }