|
Schedule.NET Events
In response to the numerous actions that can occur on a schedule, there are events
that are raised to inform the container of these actions. When an appointment is
added, removed, etc, an event is raised in which you can add custom code to handle
the situation. You may wish to commit data to a database or display information
to the user. In any case, these events provide a means to add custom functionality.
Many actions trigger event chains. The most common is the Before/After pattern.
For example, when an appointment is added two events are raised: BeforeAppointmentAdd
and AfterAppointmentAdd. In first event, the relevant information is passed through
an event parameter. This parameter object also has a read-write property "Cancel"
that allows you to cancel the action. If this property is set to true, the add does
not occur and the AfterAppointmentAdd is not raised. There are many actions that
trigger this event pattern like adding, editing, and deleting.
In the following code sample before the appointment is added, the proposed appointment's
starting date and time are written to the debug window. If the add is successful
and the AfterAppointmentAdd event is raised the newly added appointment's "Subject"
property is written to the debug window.
Some of the actions that trigger this event pattern include displaying ToolTips
or DragTips, as well as showing an appointment property dialog. In addition adding,
moving, coping, or removing Appointments will generate this event pattern. If the
user resizes columns or rows, appropriate before and after events will be raised.
There are many more. They all have in common the behavior to cancel the action in
the "Before" event.
|
|