Table of Contents

Property GlobalItems

Namespace
Alternet.Scripter.IronPython
Assembly
Alternet.Scripter.IronPython.v9.dll

GlobalItems

Gets or sets a script items collection attached to this runner.

[Browsable(false)]
public IList<IScriptGlobalItem> GlobalItems { get; }

Property Value

IList<IScriptGlobalItem>

Examples

Here is how to use a GlobalItems in the C# code:

using System.Linq;
using System.Windows.Forms;

using Alternet.Scripter.IronPython;

public partial class Form1 : Form
{
    private ScriptRun scriptRun;
    private void Form1_Load(object sender, EventArgs e)
    {
        scriptRun = new ScriptRun();
        AddScriptItem();
    }

    private void AddScriptItem()
    {
        ScriptGlobalItem item = new ScriptGlobalItem("RunButton", btNETFromScript);
        ScriptGlobalItem item1 = new ScriptGlobalItem("timer", timer);
        scriptRun.GlobalItems.Clear();
        scriptRun.GlobalItems.Add(item);
        scriptRun.GlobalItems.Add(item1);
    }
}

Here is how to use a GlobalItems in the Visual Basic code:

Imports System.Linq
Imports System.Windows.Forms
Imports Alternet.Scripter.IronPython

Partial Public Class Form1
    Inherits Form

    Private scriptRun As ScriptRun

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
        scriptRun = New ScriptRun()
        AddScriptItem()
    End Sub

    Private Sub AddScriptItem()
        Dim item As ScriptGlobalItem = New ScriptGlobalItem("RunButton", btNETFromScript)
        Dim item1 As ScriptGlobalItem = New ScriptGlobalItem("timer", timer)
        scriptRun.GlobalItems.Clear()
        scriptRun.GlobalItems.Add(item)
        scriptRun.GlobalItems.Add(item1)
    End Sub
End Class

Remarks

Use <Alternet.Scripter.IronPython.ScriptRun.GlobalItems> to add application-defined objects that can be accessed from the script code by name.