Class DebugMenu
Represents a collection of the menu items used to execute debugger-related commands.
public class DebugMenu : MenuItem, IAnimatable, IFrameworkInputElement, IInputElement, ISupportInitialize, IQueryAmbient, IAddChild, IContainItemStorage, ICommandSource
- Inheritance
-
DebugMenu
- Implements
- Extension Methods
Examples
Here is how to declare a DebugMenu from the C# code:
using System;
using System.Diagnostics;
using System.Windows;
using Alternet.Scripter.Debugger;
using Alternet.Scripter.Debugger.UI.Wpf;
public partial class MainWindow : Window
{
private void Window_Loaded(object sender, RoutedEventArgs e)
{
var debugger = new ScriptDebugger();
var debugMenu = new DebugMenu();
debugMenu.Debugger = debugger;
debugMenu.DebuggerPreStartup += OnDebuggerPreStartup;
}
private void OnDebuggerPreStartup(object sender, EventArgs e)
{
MessageBox.Show("Debugger is about to start");
}
}
Here is how to declare a DebugMenu from the Visual Basic code:
Imports System
Imports System.Windows
Imports Alternet.Scripter.Debugger
Imports Alternet.Scripter.Debugger.UI.Wpf
Partial Public Class MainWindow
Inherits Window
Private Sub Window_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
Dim debugger = New ScriptDebugger()
Dim debugMenu = New DebugMenu()
debugMenu.Debugger = debugger
debugMenu.DebuggerPreStartup += AddressOf OnDebuggerPreStartup
End Sub
Private Sub OnDebuggerPreStartup(ByVal sender As Object, ByVal e As EventArgs)
MessageBox.Show("Debugger is about to start")
End Sub
End Class
Remarks
DebugMenu contains a collection of menu items that represent commonly used debugging commands like step-by-step execution, stopping on breakpoints, examining local variables, expression evaluations, etc.
The most important properties of the DebugMenu are:
The Debugger property specifies the ScriptDebugger instance, which commands are executed by this control.
The AllowedDebuggerCommands property represents a set of commands displayed by this menu.
The CommandsListener property represents an object that allows custom handling for all commands executed via this menu.
Constructors
- DebugMenu()
Initializes a new instance of the DebugMenu class with default settings.
Fields
- CompileMenuItem
The menu item used to execute the Compile command.
- DebugBreakMenuItem
The menu item used to execute the Debug Break command.
- EvaluateMenuItem
The menu item used to execute the Evaluate command.
- RunToCursorMenuItem
The menu item used to execute the Run to Cursor command.
- StartDebugMenuItem
The menu item used to execute the Start Debug command.
- StartWithoutDebugMenuItem
The menu item used to execute the Start Without Debug command.
- StepIntoMenuItem
The menu item used to execute the Step Into command.
- StepOutMenuIem
The menu item used to execute the Step Out command.
- StepOverMenuIem
The menu item used to execute the Step Over command.
- StopDebugMenuItem
The menu item used to execute the Stop Debug command.
Properties
- AllowedDebuggerCommands
Gets or sets an allowed commands.
- CommandsListener
Gets or sets a list of the Debugger commands for the Debugger UI.
- Debugger
Gets or sets
IScriptDebuggerBase
which errors will be displayed by this user control.
- DefaultCommands
Gets
IDebuggerUICommands
processed by this menu.
Methods
- InstallKeyboardShortcuts(CommandBindingCollection)
Fills a given command list with debugger-related commands and associated key combinations.
- Localize()
Localizes string resources.
- UpdateShortcut(CommandBindingCollection, string, KeyGesture)
Updates shortcut associated with a particular command.
Events
- DebuggerPreStartup
Occurs when the execution of a program is started.