1 / 6

Events

Events. Traditional Console applications operate by waiting for a user to press a key or type a command and press the  Enter  key. Then they perform some pre-defined operation and either quit or return to the original prompt that they started from.

gaurav
Download Presentation

Events

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Events

  2. Traditional Console applications operate by waiting for a user to press a key or type a command and press the Enter key. Then they perform some pre-defined operation and either quit or return to the original prompt that they started from

  3. This works, but is inflexible in that everything is hard-wired and follows a rigid path of execution. • In contrast, modern GUI programs operate on an event-based model. • That is, some event in the system occurs and interested modules are notified so they can react appropriately. 

  4. With Windows Forms, there is not a polling mechanism taking up resources and you don't have to code a loop that sits waiting for input. It is all built into the system with events.

  5. A C# event is a class member that is activated whenever the event it was designed for occurs. •  I like to use the term "fires" when the event is activated. • Anyone interested in the event can register and be notified as soon as the event fires. • At the time an event fires, registered methods will be invoked.

More Related