Module for basic initialization

Module TLLModule
 
    'Replace bytes with your own generated in TLL Toolbox
    Private bytInitChunk() As Byte = {59, 73, 118, 210, 5, ...}
 
    Public tlli As New TreeksLicensingLibrary2.EasyIntegration.TLLInterface(bytInitChunk)
 
    Public Sub LoadCustomTranslation()
        tlli.RegistrationFormTranslations.Clear()
        tlli.RegistrationFormTranslations.Add("License is activated. You can enter new license below.")
        tlli.RegistrationFormTranslations.Add("Your hardware ID: ")
        tlli.RegistrationFormTranslations.Add(" (double-click to copy)")
        tlli.RegistrationFormTranslations.Add("We're now searching valid license online. Please allow few seconds...")
        tlli.RegistrationFormTranslations.Add("Your license was automatically activated.")
        tlli.RegistrationFormTranslations.Add("Close")
        tlli.RegistrationFormTranslations.Add("Please enter your serial number.")
        tlli.RegistrationFormTranslations.Add("We're now verifying your serial number, please wait...")
        tlli.RegistrationFormTranslations.Add("Your license was successfully activated.")
        tlli.RegistrationFormTranslations.Add("It seems we're having issues with connection to activation server. Would you like to try offline activation?")
        tlli.RegistrationFormTranslations.Add("You must enter valid e-mail to activate your license.")
        tlli.RegistrationFormTranslations.Add("All files (*.*)")
        tlli.RegistrationFormTranslations.Add("We're now verifying entered license, please wait...")
        tlli.RegistrationFormTranslations.Add("E-mail")
        tlli.RegistrationFormTranslations.Add("Serial number")
        tlli.RegistrationFormTranslations.Add("Cancel")
        tlli.RegistrationFormTranslations.Add("Register")
        tlli.RegistrationFormTranslations.Add("Buy license")
        tlli.RegistrationFormTranslations.Add("Load license from file")
        tlli.RegistrationFormTranslations.Add("License data")
        tlli.RegistrationFormTranslations.Add("Show more licensing options")
        tlli.RegistrationFormTranslations.Add("Migrate to new PC")
        tlli.RegistrationFormTranslations.Add("Offline activation")
        tlli.RegistrationFormTranslations.Add("Auto activation")
        tlli.RegistrationFormTranslations.Add("Delete local license")
        tlli.RegistrationFormTranslations.Add("Copy hardware ID")
        tlli.RegistrationFormTranslations.Add("We have deactivated license on this computer.")
        tlli.RegistrationFormTranslations.Add("Actual license was cleared from registry.")
        tlli.RegistrationFormTranslations.Add("HardwareID was copied to clipboard.")
        tlli.RegistrationFormTranslations.Add("Get offline license") 
        tlli.RegistrationFormTranslations.Add("License is activated. License owner:")
        tlli.RegistrationFormTranslations.Add("How to activate license on offline computer")
        tlli.RegistrationFormTranslations.Add("1. Note your hardware ID:")
        tlli.RegistrationFormTranslations.Add("2. Note offline activation form URL")
        tlli.RegistrationFormTranslations.Add("3. Visit offline activation form on any other online computer, use hardware ID above and get license file for this PC.")
        tlli.RegistrationFormTranslations.Add("4. Copy the activation file (using USB drive, etc) to offline computer and use it.")
    End Sub
 
End Module

Code within form example

Public Class Form1
 
 
    Private Sub Form1_Shown(sender As Object, e As System.EventArgs) Handles Me.Shown
        TLLInit()
    End Sub
 
    Private Sub TLLInit()
        LoadCustomTranslation()
 
recheck_license:
        If tlli.MyLicense Is Nothing OrElse tlli.MyLicense.IsDemo Then
            'Do something when in demo/no license state (write your own code)
            'Optionally show registration dialog
 
 
            Dim dres As DialogResult = tlli.ShowRegistrationForm(Me, "App license")
 
            If dres = Windows.Forms.DialogResult.OK Then
                GoTo recheck_license
            End If
        Else
            ' Add your app code when full license is activated
 
            ' In case you use TLL activation server uncomment following lines to enable revocation check and silent reactivation
            If (tlli.OnlineRevocationCheck()) Then
 
                tlli.AsyncSilentReactivation()
 
            Else
 
                ' Invalid/pirated license detected
                Application.Exit()
            End If
        End If
    End Sub
 
End Class