Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

Hull and Outfitting

Class StatusEvents

  • Last UpdatedJul 04, 2024
  • 1 minute read

This class gives access to all the status change events. An instance of the class cannot be instantiated directly by constructor. Instead an instance can be created from the Status.Events property, or from the static functions StatusEvent.GetStatusEventObject(Status s) or StatusEvent.GetStatusEventObject(). The following example shows the registration of an event handler for the BeforeStatusChange event together with a sample implementation of the registered event handler:

Status status = Status("/DesignStatus");

StatusEvent statusEvent = status.Event;

statusEvent.BeforeStatusChange += new
StatusEvent.BeforeStatusChangeEventHandler(My_BeforeStatusChange);

// ...

// Event handler

private void My_BeforeStatusChange (object sender,

                                    CancelStatusEventArgs e)

{

// Do any extra actions and check status change is allowed

if ( /* abort status change required */ )

{

e.Cancel = true;

e.Message = "reason not to proceed";

}

}

The list of available status events is displayed in the Visual Studio Object Browser display as follows:

Related Links
TitleResults for “How to create a CRG?”Also Available in