Integrate with your application

Introduction

Treek’s Licensing Library was made to allow extensive customization and leaves up to your creativity to make registration dialogs and the way, how should your users register license to your application.

However, we’ll describe some typical steps you need to take. We’re assuming, that you have taken steps described in Getting started chapter.

Create registration dialog

Maybe, you won’t even need this dialog, because you can simply supply license files, but we believe, that’s the good thing to do, because you need to direct user to website, where he can purchase your license or it can be place to show license details, like owner name, expiration date or hardware id. To display license information from TreeksLicensingLibrary.dll, simply use the License object, which you can get during verification of license.

License checking functions

You’ll probably need to internally check on some places of your code for validity of user license. You can do this by using a new instance of TreeksLicensingLibrary.LicenseVerification class. You can see the example of LicenseVerification class usage or follow these steps in your code:

  1. Create a new instance of TreeksLicensingLibrary.LicenseVerification class
    1. While creating new instance, you must supply your public key XML. In toolbox load your keypair and click “Copy public key” button.
  2. Specify the path of registration file
  3. Use VerifyLicenseFile function of LicenseVerification object to check if user has supplied valid license file.
    1. First paremeter (strPath) is the path to the registration file
    2. Second parameter (ErrorMessage) is reference to string defined in your application in which will be loaded text describing the reason of license validation failure, if there’s any – on success returns empty string.
    3. Third parameter (LicenseObject) is an instance of TreeksLicensingLibrary.License., which will be created during license verification. If license contains additional information, you’ll be able to get them via this object.

You can use VerifyLicenseXML function instead of VerifyLicenseFile. VerifyLicenseXML is accepting license in string format instead of specifying path to the file. This is usable when you store your license details in registry or in different form, than are default library license files.