Skip to content
Jing edited this page Jul 25, 2019 · 8 revisions

WorkMode is a property of ScriptRunningMachine to decide the script's features. Currently the following mode are available:

  • AllowDirectAccess

    Allows script to access .NET class or object directly, such as access the property value, call methods and bind 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 related 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 mode is disabled the script executing will be terminated when exception is thrown. (default is enable)

Change WorkMode

Enable WorkMode

To enable a feature, set the WorkMode to the feature enumeration name.

ScriptRunningMachine srm = new ScriptRunningMachine();
srm.WorkMode = MachineWorkMode.AllowDirectAccess;

Multiple feature can be merged like:

srm.WorkMode |= MachineWorkMode.AllowDirectAccess | MachineWorkMode.AllowCLREventBind;

Disable WorkMode

To disable a feature:

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

Reset WorkMode

To reset WorkMode to default value:

srm.WorkMode = MachineWorkMode.Default;