Class Status
- Last UpdatedMar 10, 2023
- 3 minute read
This class gives access to a named status definition determined in the constructor either by name or as a DbElement:
Status status = Status("/DesignStatus");
DbElement statusDefinitionElement;
// ...
Status status = Status(statusDefinitionElement);
The screenshot below of the Visual Studio Object Browser details the public interface of the Status class:

Class StatusValue
This class gives access to the data relating to a Status Value (STAVAL element). This represents one of the legal states that an element controlled for a given status definition may have. The status definition and value can be determined via the class constructors:
Status status = Status("/DesignStatus");
StatusValue statusValue = StatusValue(status, "/Approved");
Or:
DbElement statusValueElement;
// ...
StatusValue statusValue = StatusValue(statusValueElement);
Alternatively, the array of all StatusValues for a given status definition can be obtained directly from a Status object:
Status status = Status("/DesignStatus");
StatusValue[] statusValues = status.Values;
The remaining functions of the StatusValue class are displayed in the Visual Studio Object Browser below:

Class StatusCommand
This static class gives access to all the status functionality. As a static class no instances of the class are created. This class effectively duplicates the functionality otherwise available through instances of the Status class. The Visual Studio Object Browser display is as follows:

Class StatusEvents
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:

Status Change Events
The Before … event methods can cancel the operation.
|
Event |
Arguments |
|
BeforeStatusAssign |
object sender, CancelStatusEventArgs e |
|
AfterStatusAssign |
object sender, StatusEventArgs e |
|
BeforeStatusRemove |
object sender, CancelStatusEventArgs e |
|
AfterStatusRemove |
object sender, StatusEventArgs e |
|
BeforeStatusChange |
object sender, CancelStatusEventArgs e |
|
AfterStatusChange |
object sender, StatusEventArgs e |
|
BeforeControlledElementDelete |
object sender, CancelStatusEventArgs e |
StatusEventArgs
|
Name |
Type |
Description |
|
Model |
DbElement[] |
Array of elements that is/to be controlled. |
|
Status |
Status |
The Status object. |
|
To |
StatusValue |
The to StatusValue object. |
CancelStatusEventArgs
|
Name |
Type |
Description |
|
Model |
DbElement[] |
Array of elements that is/to be controlled. |
|
Status |
Status |
The Status object. |
|
To |
StatusValue |
The to StatusValue object. |
|
Cancel |
Bool |
Cancel the ongoing operation. |
|
Message |
String |
With this as the message. |
Database Change Events
The Before … event methods can cancel the operation.
|
Event |
Arguments |
|
BeforeSavework |
object sender, CancelDBChangeEventArgs e |
|
AfterSavework |
object sender, DBChangeEventArgs e |
|
BeforeFlush |
object sender, CancelDBChangeEventArgs e |
|
AfterFlush |
object sender, DBChangeEventArgs e |
DBChangeEventArgs
|
Name |
Type |
Description |
|
Status |
Status |
The Status object. |
|
Assigned |
DbElement[] |
Array of DbElements that had Status assigned. |
|
Changed |
DbElement[] |
Array of DbElements that had Status changed. |
|
Removed |
DbElement[] |
Array of DbElements that had Status removed. |
CancelDBChangeEventArgs
|
Name |
Type |
Description |
|
Status |
Status |
The Status object. |
|
Assigned |
DbElement[] |
Array of DbElements that had Status assigned. |
|
Changed |
DbElement[] |
Array of DbElements that had Status changed. |
|
Removed |
DbElement[] |
Array of DbElements that had Status removed. |
|
Cancel |
Bool |
Cancel the ongoing operation. |
|
Message |
String |
With this as the message. |