Class ScriptManager
The script manager manages IScript blocks. A script block is a unit of code that does one particular job. It is used by the script manager to navigate through your menu options.
Implements
Inherited Members
Namespace: ivrToolkit.Core
Assembly: ivrToolkit.Core.dll
Syntax
public class ScriptManager : IScriptManager
Remarks
An example of a simple IVR program using script blocks would be:
ScriptBlocks\Welcome.cs
ScriptBlocks\MainMenu.cs
ScriptBlocks\Option1.cs
ScriptBlocks\Option2.cs
Examples
// create the script manager
ScriptManager scriptManager = new ScriptManager(line, startingScript);
// run the script blocks
while (scriptManager.hasNext())
{
scriptManager.execute();
}
line.hangup();
Constructors
| Edit this page View SourceScriptManager(ILoggerFactory, IScript)
Declaration
public ScriptManager(ILoggerFactory loggerFactory, IScript startingScript)
Parameters
Type | Name | Description |
---|---|---|
ILoggerFactory | loggerFactory | |
IScript | startingScript |
Properties
| Edit this page View SourceNextScript
The next script block to be executed.
Declaration
public IScript NextScript { get; set; }
Property Value
Type | Description |
---|---|
IScript |
Methods
| Edit this page View SourceExecute()
Executes the next script block. Used with HasNext()
Declaration
public void Execute()
ExecuteAsync(CancellationToken)
Asynchronously executes the next script block. Used with HasNext()
Declaration
public Task ExecuteAsync(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |
ExecuteScriptAsync(CancellationToken)
Asynchronously executes all the script blocks.
Declaration
public Task ExecuteScriptAsync(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |
HasNext()
Checks to see if there is another script block to execute.
Declaration
public bool HasNext()
Returns
Type | Description |
---|---|
bool | Returns the next script block to execute or null if there are no more. |