Table of Contents

Class Locals

Namespace
Alternet.Scripter.Debugger.UI.Wpf
Assembly
Alternet.Scripter.Debugger.UI.Wpf.v9.dll

Displays and evaluates local variables during script debugging.

public class Locals : VariablesEvaluationControlBase, IAnimatable, IFrameworkInputElement, IInputElement, ISupportInitialize, IQueryAmbient, IAddChild, EvaluationResultsTreeController.IHost
Inheritance
Locals
Implements
Extension Methods

Examples

Here is how to declare a Locals and handle its events 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 localsControl = new Locals();
        localsControl.Debugger = debugger;
        localsControl.AddToWatchClick += LocalsControl_AddToWatchClick;
    }

    private void LocalsControl_AddToWatchClick(object sender, AddToWatchClickEventArgs e)
    {
        if (!string.IsNullOrEmpty(e.Expression))
        {
            System.Windows.MessageBox.Show(e.Expression);
        }
    }
}

Here is how to declare a Locals and handle its events from the Visual Basic code:

Imports System

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 localsControl = New Locals()
        localsControl.Debugger = debugger
        AddHandler localsControl.AddToWatchClick, AddressOf LocalsControl_AddToWatchClick
    End Sub

    Private Sub LocalsControl_AddToWatchClick(ByVal sender As Object, ByVal e As AddToWatchClickEventArgs)
        If Not String.IsNullOrEmpty(e.Expression) Then
            Windows.MessageBox.Show(e.Expression)
        End If
    End Sub
End Class

Remarks

Locals is a visual control used to examine the values of local variables when debugging code step-by-step.

The most important properties of the Locals are:

The Debugger property specifies the ScriptDebugger instance, which local variables are displayed and evaluated by the Locals control.

The SelectedWatch property represents the currently selected watch expression.

Constructors

Locals()

Initializes a new instance of the Locals class with default settings.

Properties

ResultsTreeView
SelectedResult
SelectedText

Gets a currently selected text.

SelectedWatch

Gets a currently selected watch expression.

Methods

EvaluateVariables(IEnumerable<string>)

Evaluates values of given variables asynchronously.

Localize()
OnDebuggerChanged(IScriptDebuggerBase, IScriptDebuggerBase)

Events

AddToWatchClick

Occurs when a user clicks on the local to add it to the watch window.