aceEventGeneralArgs Class |
Namespace: imbACE.Core.events
The aceEventGeneralArgs type exposes the following members.
| Name | Description | |
|---|---|---|
| aceEventGeneralArgs | Initializes a new instance of the aceEventGeneralArgs class |
| Name | Description | |
|---|---|---|
| isCanceled | if true, it will tell to the event handling party to try canceling / preventing, if event is preventable | |
| Message | Textual message attached to the event | |
| Origin | Indication on the event origin (optional) | |
| Path | Filesystem, network or application resources path - pointing to the position of event origin | |
| Properties | Additional meta data on the event | |
| RelatedObject | An object that is relevant to the event (not sender) - this property is not serialized | |
| type | Type of the event |
| Name | Description | |
|---|---|---|
| aceGenEx | (Defined by aceExceptionTools.) | |
| aceSciEx | (Defined by aceExceptionTools.) |
Try to avoid any automatic and assumption-based value attribution to the Event Arguments information
Set only data that are:
GuidelinesIn case of exception or crash: populate Properties with any useful Exception and/or contextual information for easier debugSet type and/or Origin only if it can be useful for event interpretationImplement isCanceled in case the event is yet to happen (e.g. [!:aceEventType.closing], [!:aceEventType.saving])Recommended application of the imbACE EventGeneralArgs
// Event receiver public class anAceObjectListener { public anAceObject createObject() { var a = new anAceObject(); a.EventOpDone += c_operation; return a; } public void c_operationDone(object sender, aceEventGeneralArgs e) { // code that reacts to the event Environment.Exit(0); } } // Event sender public class anAceObject { protected String operationName {get;set;} = "doSomething"; // Event handler public event EventHandler<aceEventGeneralArgs> EventOpDone; // protected virtual void OnOperationDone(aceEventGeneralArgs e) { e.Properties["OperationName"]=operationName; if (e.type == aceEventType.unknown) e.type = aceEventType.finished; EventOpDone(this, e); } // "Closed" scenario - when we know exactly what happen protected virtual void OnStarted() { var e = aceEventGeneralArgs(aceEventType.started); EventOpDone(this, e); } }