执行 SPEL+ 程序

SPEL+ 程序包含一个或多个函数,可通过开始程序的 main 函数运行该程序。通过使用 Spel 类的 Start 方法,可运行当前控制器项目中 64 个内置main 函数中的任意一个。要开始的 main 函数必须以 SPEL+ 代码定义。开始一个 main 函数时,所有全局变量和模块变量返回默认值。
下表所示为 SPEL+ 项目中的程序编号及其相应的函数名称。

程序编号 SPEL+ 函数名称
0 main
1 main1
2 main2
3 main3
... ...
63 main63

以下为“main”函数的开始示例:
VB 例:

Sub btnStart_Click( _  
       ByVal sender As System.Object, _  
       ByVal e As System.EventArgs) _  
       Handles btnStart.Click  
  
    m_spel.Start(0) '开始执行 main 函数  
    btnStart.Enabled = False  
    btnStop.Enabled = True  
End Sub  

C# 例:

void btnStart_Click(object sender, EventArgs e)  
{  
    m_spel.Start(0); //开始执行 main 函数  
    btnStart.Enabled = false;  
    btnStop.Enabled  = true;  
}