| Visual Basic (Declaration) | |
|---|---|
<CategoryAttribute("Progress")> <DescriptionAttribute("Raised when the value of the Busy property changes.")> Public Event BusyChanged As EventHandler | |
| Visual Basic (Usage) | Copy Code |
|---|---|
Dim instance As Smtp Dim handler As EventHandler AddHandler instance.BusyChanged, handler | |
| C# | |
|---|---|
[CategoryAttribute("Progress")] [DescriptionAttribute("Raised when the value of the Busy property changes.")] public event EventHandler BusyChanged | |
| Managed Extensions for C++ | |
|---|---|
[CategoryAttribute("Progress")] [DescriptionAttribute("Raised when the value of the Busy property changes.")] public: __event EventHandler* BusyChanged | |
| C++/CLI | |
|---|---|
[CategoryAttribute("Progress")] [DescriptionAttribute("Raised when the value of the Busy property changes.")] public: event EventHandler^ BusyChanged | |
The following example demonstrates using the BusyChanged event to see if the socket is busy.
| Visual Basic | Copy Code |
|---|---|
' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Mail" ' at the top of your class. Private Sub BusyTest() ' Do something to cause the Busy event to be raised ' Create a message Dim msg As New MessageStream() msg.To.Add(New MailAddress("you@test.com")) msg.From = New MailAddress("me@test.com") msg.Subject = "test" msg.Attachments.Add("C:\test\test.bmp") Smtp1.Server = "mail.test.com" Smtp1.Send(msg) End Sub Private Sub Smtp1_BusyChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Smtp1.BusyChanged If Smtp1.Busy Then label1.Text = "Socket is busy" Else label1.Text = "Socket is not busy" End If End Sub | |
| C# | Copy Code |
|---|---|
// Be sure to import the namespace by putting "using Dart.PowerTCP.Mail;" // at the top of your class. private void BusyTest() { // Do something to cause the Busy event to be raised // Create a message MessageStream msg = new MessageStream(); msg.To.Add(new MailAddress("you@test.com")); msg.From = new MailAddress("me@test.com"); msg.Subject = "test"; msg.Attachments.Add("C:\\test\\test.bmp"); smtp1.Server = "mail.test.com"; smtp1.Send(msg); } private void smtp1_BusyChanged(object sender, System.EventArgs e) { // Check the Busy Property if(smtp1.Busy) label1.Text = "Socket is busy"; else label1.Text = "Socket is not busy"; } | |
This event is fired when the value of the Object.Busy property changes. The Object.Busy property changes when a method is executing that is occupying the TCP connection.
This event is useful in several scenarios, for example:
- Displaying to the user when the PowerTCP component is busy.
- Taking action within your application when the PowerTCP component is no longer busy.
If you are using the PowerTCP component as a reference, you must create a method to handle the event yourself. For more information on using events using PowerTCP.NET within the Visual Studio.NET environment, see Using Events In PowerTCP.
Target Platforms: Microsoft .NET Framework 2.0