private void Debugger_DebugStateChanged(DebugState newState)
{
if (_guiController.InvokeRequired)
{
_guiController.Invoke(new DebugController.DebugStateChangedHandler(Debugger_DebugStateChanged), newState);
return;
}
_debuggerState = newState;
if (newState == DebugState.Running)
{
_guiController.SetTitleBarPrefix("[Debugging] ");
}
else if (newState == DebugState.Paused)
{
_guiController.SetTitleBarPrefix("[Break] ");
}
else
{
_guiController.SetTitleBarPrefix(string.Empty);
_guiController.HideCallStack();
_guiController.HideFindSymbolResults();
}
foreach (MenuCommand command in _debugToolbarCommands)
{
if (command.ID == STOP_COMMAND)
{
command.Enabled = (newState != DebugState.NotRunning);
_guiController.SetMenuItemEnabled(this, STOP_COMMAND, command.Enabled);
}
else if (command.ID == PAUSE_COMMAND)
{
command.Enabled = (newState == DebugState.Running);
_guiController.SetMenuItemEnabled(this, PAUSE_COMMAND, command.Enabled);
}
else if (command.ID == STEP_INTO_COMMAND)
{
command.Enabled = (newState == DebugState.Paused);
_guiController.SetMenuItemEnabled(this, command.ID, command.Enabled);
}
else if (command.ID == RUN_COMMAND)
{
command.Enabled = (newState != DebugState.Running);
_guiController.SetMenuItemEnabled(this, command.ID, command.Enabled);
}
}
Factory.ToolBarManager.UpdateItemEnabledStates(_debugToolbarCommands);
}