License your windows application with Licensing API


License Manager API provides full set of functionality and customization to impart the licensing feature in any .Net application. The API is highly flexible and the application code can customize the behavior of how the system would work. Make sure you have a look at the sample demo provided with the API to have a feel of how to get started.

API Usage

The API is very simple and easy to use. Here is how you can implement the features. Note that this is just an example to get you started. You can do much more after you become familiar with the API.

Step 1: Implement ILicensable

The first step is to implement ILicensable interface. This interface should be implemented by the main class of your application, or the class from where the main logic of the application starts. For example assuming that you have created a WPF application and MainWindow is your starting window, you will need MainWindow class to implement the interface.


The event ComponentStarted should be raised right after the startup of application and before initialization of LicenseManager(later step). It is recommended to do it in the constructor itself prior to any business logic. Here is the snippet-



Step 2: Decide the licensing methodology

Currently there are two types of system supported: per user license type and per machine license type. Here is the distinction between the two:

Per User License : Per user license is what most applications normally uses. The same registration key can be used across multiple machines. This type of license doesn’t require an online server. Use this license type when you don’t need to have a per machine license regularly verifying the validity from the server.

Per Machine License : Per machine license allows only single license per machine. The same registration key can not be used across different machines. This type of license require an online server and also gives you the added flexibility of managing the users (like banning them, updating their license etc.)

Deciding the appropriate licensing methodology is critical before you move forward with the implementation

Step 3: Implement IOnlineLicenseServer/IOfflineLicenseServer

Depending on which licensing methodology you have chosen, implement the appropriate license server. For per user license type, you need to implement IOfflineLicenseServer. For per machine license type, you need to implement IOnlineLicenseServer. Here is a sample:


Note: In case of Online license server (server side), you need to save the registration info of a user and map it the corresponding machine id so that next time when the server is queried about the license status with machine id as input parameter, the server would return the corresponding values.

Step 4: Fetch ILicenseManager object

This is the final step before you can start playing with the API. You need get hold of a license manager object using LicenseManagerFactory. This license manager object is kind of a controller you can use to interact with the API. This object would provide you all the necessary methods and properties required for your client application. To get the object, call GetLicenseManager method of LicenseManagerFactory class passing in the ILicensable component (which you implemented before) and an ILicenseTypeWrapper object. There are two classes which implements this interface – PerMachineLicense and PerUserLicense. Depending on your strategy, create an instance of the appropriate class and pass it to the factory method.


Step 5: Play with ILicenseManager object

After getting the ILicenseManager object, it is recommended to store it as a class level field/property so that you can call the methods on that object whenever required. There are a bunch of methods and properties exposed via this class. Most of them are self explanatory. Though you can always have a look in this documentation for precise description of what they does. Just for an example you should call the RegisterMachine/RegisterMachineAsync method to register the current software.

That’s it. You now know the required procedure to get started with the API.

Go ahead and download the API, it also contains a sample application to help you understand it better.

[ddownload id=”2528″ style=”button” button=”black” text=”Download”]

Total Downloads: [ddownload_count id=”2528″]

File Size: [ddownload_filesize id=”2528″]


Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.