Skip to content
Jing Lu edited this page May 14, 2013 · 8 revisions

What is WorkMode

WorkMode is a property of ScriptRunningMachine to indicate ScriptRunningMachine should works in what mode, The following mode are available:

  • AllowDirectAccess

    Allows script to access .Net object directly, such as getting or setting propery value, calling methods and binding events. (default is disable, See DirectAccess)

  • AllowImportTypeInScript - Allows import .Net Namespaces and Classes in script using 'import' keyword. (default is disable, See CLR Type Importing)

AutoImportRelationType Allows ReoScript to auto-import the relation types that may used in other imported type. (default is enable) AllowCLREventBind Allows to auto-bind CLR event. This option works only AllowDirectAccess. (default is disable) See Event Binding. IgnoreCLRExceptions Ignore all exceptions that may caused in .Net calling. If this flag is enabled the script executing will be terminated when exception is thrown. (default is enable) Enable Behavior

Use following code to change machine's work mode:

ScriptRunningMachine srm = new ScriptRunningMachine(); srm.WorkMode |= MachineWorkMode.AllowDirectAccess | MachineWorkMode.AllowCLREventBind; Disable Behavior

To disable executing behavior, change machine's work mode as below:

srm.WorkMode &= ~(MachineWorkMode.AllowCLREventBind);

Reset Mode

To reset work mode:

srm.WorkMode = MachineWorkMode.Default;