Click or drag to resize

RapidExecutionStatusChanged Event

This event occurs when ExecutionStatus property has changed.

Namespace:  ABB.Robotics.Controllers.RapidDomain
Assembly:  ABB.Robotics.Controllers (in ABB.Robotics.Controllers.dll) Version: 6.5.129.0
Syntax
C#
public event ExecutionStatusChangedEventHandler ExecutionStatusChanged

Value

Type: ABB.Robotics.Controllers.RapidDomainExecutionStatusChangedEventHandler
Exceptions
ExceptionCondition
GeneralExceptionA General Exception has occurred.
Remarks
Any subscriber that wants to update their UI as response to the event has to redirect the execution to the UI-thread, using a Invoke method. Note: You should not switch to UI-thread if you don't have to since a thread switch have impact on performance.
Examples
This example sets up a subscription to the ExecutionStatusChanged event. When a RAPID program starts executing the GUI of the application should be disabled and when the execution stops it should be enabled.
bool ITpsViewSetup.Install(object sender,object data)
{
bool result = true;
try
{
        // Create Controller
        c = new Controller();

        c.Rapid.ExecutionStatusChanged += 
            new ExecutionStatusChangedEventHandler(r_ExecutionStatusChanged);
}
catch (System.Exception ee)
{
    result = false;
}

    return result;
}
// Event handler
private void r_ExecutionStatusChanged(object sender, ExecutionStatusChangedEventArgs e)
{
    try
    {
    //Controller events execute on a background thread. Enforce switch to GUI thread 
    //by the use of Invoke to avoid thread conflict.
        this.Invoke(new EventHandler(UpdateUiOnExeStatusChanged),sender,e);
    }
    catch (System.Exception ee)
    {
        // Any error handling goes here
    }
}
// The method is guaranteed to execute on the UI-thread.
private void UpdateUiOnExeStatusChanged(object sender, EventArgs e)
{
    try
    {
        ExecutionStatusChangedEventArgs exStatusArg 
            = (ExecutionStatusChangedEventArgs) e;
        if (exStatusArg.NewStatus == ExecutionStatus.Running)
            this.DisableUI();
        else
            this.EnableUI();
    }
    catch (System.Exception ee)
    {
        // Any error handling goes here
    }
}
See Also