SocketTools .NET Edition

ImapClient.Initialize Method (String)

Initialize an instance of the ImapClient class.

[Visual Basic]
Overloads Public Function Initialize( _
   ByVal licenseKey As String _
) As Boolean
[C#]
public bool Initialize(
   string licenseKey
);

Return Value

A boolean value which specifies if the class was initialized successfully.

Remarks

The Initialize method can be used to explicitly initialize an instance of the ImapClient class, loading the networking library and allocating resources for the current thread. Typically an application would define the license key as a custom attribute, however this method can be used to initialize the class directly.

The runtime license key for your copy of SocketTools can be generated using the License Manager utility that is included with the product. Note that if you have installed an evaluation license, you will not have a runtime license key and cannot redistribute any applications which use the ImapClient class.

Example

The following example shows how to use the Initialize method to initialize an instance of the class. This example assumes that the license key string has been defined in code.

[CS]
SocketTools.ImapClient imapClient = new SocketTools.ImapClient();
 
if (imapClient.Initialize(strLicenseKey) == false)
{
    MessageBox.Show(imapClient.LastErrorString, "Error",
                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
    return;
}
    
[Visual Basic]
Dim imapClient As New SocketTools.ImapClient
 
If imapClient.Initialize(strLicenseKey) = False Then
    MsgBox(imapClient.LastErrorString, vbIconExclamation)
    Exit Sub
End If
    

See Also