menu

WinForms

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class ScriptSite - WindowsForms API Reference | Syncfusion

    Show / Hide Table of Contents

    Class ScriptSite

    Provides the script engine with access to objects referenced by the script.

    Inheritance
    System.Object
    ScriptSite
    DefaultScriptSite
    HTMLScriptSite
    Implements
    Microsoft.Vsa.IVsaSite
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Syncfusion.Scripting
    Assembly: Syncfusion.Scripting.Base.dll
    Syntax
    public class ScriptSite : IVsaSite
    Remarks

    A ScriptSite contains objects that are used as global variables and event sources by the script. The objects must be registered by the hosting application before the script is compiled and executed by the script engine. Objects are registered using the RegisterEventSource(String, Object) and RegisterGlobalInstance(String, Object) methods. The script engine accesses the objects using the GetGlobalInstance(String) and GetEventSourceInstance(String, String) methods.

    The ScriptSite also contains the compiled state of the script. The compiled state is the compiled byte-code and debug information used by the script engine during execution. The compiled state can be put into the ScriptSite by calling the SetCompiledState(IVsaEngine) method and passing it the script engine after the script has been compiled. The compiled state can be accessed by calling the GetCompiledState(out Byte[], out Byte[]) method.

    Constructors

    ScriptSite()

    Default constructor.

    Declaration
    public ScriptSite()

    Methods

    Clear()

    Removes all event sources, global instances, and compiled code from the site.

    Declaration
    public virtual void Clear()

    ClearCompiledState()

    Clears out the compiled state of the script.

    Declaration
    public void ClearCompiledState()

    GetCompiledState(out Byte[], out Byte[])

    Gets the compiled state of a script engine, and, optionally, associated debugging information.

    Declaration
    public virtual void GetCompiledState(out byte[] pe, out byte[] debugInfo)
    Parameters
    Type Name Description
    System.Byte[] pe
    System.Byte[] debugInfo

    GetEventSourceInstance(String, String)

    Gets a reference to an event source previously added to a script engine using the IVsaCodeItem.AddEventSource method.

    Declaration
    public virtual object GetEventSourceInstance(string itemName, string eventSourceName)
    Parameters
    Type Name Description
    System.String itemName
    System.String eventSourceName
    Returns
    Type
    System.Object

    GetGlobalInstance(String)

    Gets a reference to a global item, such as the host-provided application object.

    Declaration
    public virtual object GetGlobalInstance(string globInstanceName)
    Parameters
    Type Name Description
    System.String globInstanceName
    Returns
    Type
    System.Object

    Notify(String, Object)

    Notifies the host about events generated by the .NET script engine.

    Declaration
    public virtual void Notify(string notify, object info)
    Parameters
    Type Name Description
    System.String notify
    System.Object info

    OnCompileError(VsaErrorEventArgs)

    Called when an error occurs during compilation.

    Declaration
    protected virtual void OnCompileError(VsaErrorEventArgs evtArgs)
    Parameters
    Type Name Description
    VsaErrorEventArgs evtArgs

    OnCompilerError(IVsaError)

    Notifies the host about how to respond to compiler errors encountered by the script engine.

    Declaration
    public virtual bool OnCompilerError(IVsaError error)
    Parameters
    Type Name Description
    Microsoft.Vsa.IVsaError error
    Returns
    Type
    System.Boolean

    RegisterEventSource(String, Object)

    Registers and event source with the site.

    Declaration
    public virtual void RegisterEventSource(string name, object obj)
    Parameters
    Type Name Description
    System.String name

    Name of the event source

    System.Object obj

    Event source object

    RegisterGlobalInstance(String, Object)

    Registers a global instance with the site.

    Declaration
    public virtual void RegisterGlobalInstance(string name, object obj)
    Parameters
    Type Name Description
    System.String name

    Name of the global instance

    System.Object obj

    Global instance object

    SetCompiledState(IVsaEngine)

    Attaches the compiled state of the given script engine to the site.

    Declaration
    public void SetCompiledState(IVsaEngine scriptEngine)
    Parameters
    Type Name Description
    Microsoft.Vsa.IVsaEngine scriptEngine

    Script engine that contains compiled state

    Events

    CompileError

    Fired when an error occurs during compilation.

    Declaration
    public event VsaErrorEventHandler CompileError
    Event Type
    Type
    VsaErrorEventHandler

    Implements

    Microsoft.Vsa.IVsaSite
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved