Events are very important for using PowerTCP because communications works best in applications when it occurs asynchronously. The application can validate an email address or a list of email addresses, perform other tasks, and have an event raised when the validation completes. The application, however, is responsible for “hooking up†events to the application’s “event handlerâ€.
Within the Visual Studio environment, this is most easily accomplished by dragging the Validator component onto a form, and using the Properties window to create an event handler.
Alternatively, for non-Visual Studio environments, or when using a component as a reference, you have to “wire-up†events to an “event handler†by adding the code yourself. The following C# code snippet shows how the Visual Studio wires up an event handler. You can use the same technique in any development environment:
[C#]
//Signals the completion of an asynch BeginValidate call
Validator1.EndValidate += new Dart.PowerTCP.Validator.ValidateEventHandler(Validator1_EndValidate);
//Provides progress information when validating an email address
Validator1.Progress += new Dart.PowerTCP.Validator.ProgressEventHandler(Validator1_Progress);
//Provides debug information when the component communicates with mail servers
Validator1.Smtp.Trace += new Dart.PowerTCP.Validator.SegmentEventHandler(Validator1_Smtp_Trace);
You will probably need to perform some event processing, depending upon the complexity of your application.
Send comments on this topic.
Documentation version 1.0.3.0.
© 2008 Dart Communications. All rights reserved.