Previous Topic: Removing Scenarios: remove_scenario()Next Topic: Synchronizing Running Scenarios: synchronize()


Importing Scenarios: import_scenario()

The import_scenario API function lets you import scenarios to the Control Service.

Arguments

The import_scenario API function includes the arguments described in the following table:

Type

Name

Description

session_id

uint

The session ID that was returned by calling the create_session API.

group_id

uint

The scenario group ID that you want to import. If you are not sure of the group ID, set this to 0xFFFFFFFF.

scenario_id

out uint

Retrieves the scenario id when the API completes successfully.

scenario_data

string

The data about the scenario. Typically, you retrieve the scenario data string from a scenario file. The data is in an XML format.

why_not_reason

out string

Contains the reason for failure when this API fails.

Return Values

The return values provide the data for the scenario in xml format.

Example

public bool import_scenario_example()
        {
            try
            {
                uint scenario_id = 0;
                string why_not_reason = "";
                string scenario_data = "load the data from a scenario file.";
                uint group_id = 0xFFFFFFFF;
                return get_mng().import_scenario(_session_id, group_id,scenario_data,out scenario_id,out why_not_reason);
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
            }
            return false;
        }