...
using System;
using XFormation;
using System.ComponentModel;
using System.Windows.Forms;
// Adds the LicenseProviderAttribute to the control.
[LicenseProvider(typeof(LmxLicenseProvider))]
public class MyControl : Control
{
// Creates a new, null license.
private License license = null;
private string strFeatureName = "feature";
private int nMajorVer = 1;
private int nMinorVer = 0;
private int nCount = 1;
public MyControl ()
{
// Adds Validate to the control's constructor.
if (nMajorVer >= 0 && nMinorVer >= 0 && nCount >= 0 && strFeatureName.Length > 0)
license = LicenseManager.Validate(typeof(MyControl), this);
else throw new LicenseException(typeof(MyControl), this, "Fields are not properly set.");
// Insert code to perform other instance creation tasks here.
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
if (license != null)
{
license.Dispose();
license = null;
}
}
}
}
As you can see, modifying a LicenseProvider base class to use LmxLicenseProvider requires only a few minor changes and new lines of code, making it quick and easy for you to realize the significant benefits LM-X can bring to your .NET licensing model.