iSpring SDK License Activation via COM API
The following example illustrates how to activate the license using COM API.
You'll need the ILicenseManager interface that can be obtained from the IPresentationConverter.LicenseManager property.
C# license activation
using iSpring;
using System;
namespace activateSampleCSharp
{
class Program
{
static void Main(string[] args)
{
IPresentationConverter converter = new PresentationConverter();
ILicenseManager licenseManager = converter.LicenseManager;
try
{
licenseManager.LicenseKey = "5AHKK-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX";
licenseManager.ActivateLicense();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
Console.WriteLine("License is " + (licenseManager.LicenseIsActivated ? "" : "not ") + "activated.");
string licenseType = "";
switch (licenseManager.LicenseType)
{
case LicenseType.LT_NONE:
licenseType = "None";
break;
case LicenseType.LT_OEM:
licenseType = "OEM";
break;
case LicenseType.LT_OEM_NA:
licenseType = "OEM, no activation needed";
break;
case LicenseType.LT_TRIAL:
licenseType = "Trial";
break;
}
Console.WriteLine("License type: " + licenseType);
}
}
}
C#
If no Internet connection is available, there is also an option to activate the license manually.
First, get a request code that is generated:
C# get request code
IPresentationConverter converter = new PresentationConverter();
Console.WriteLine(converter.LicenseManager.ActivationRequestCode);
C#
Next, you will need to contact our Support Department and provide them with this request code. They will then send you a license activation code that should be used for the LicenseActivationCode property of the ILicenseManager interface:
C# offline activation
using iSpring;
using System;
namespace activateSampleCSharp
{
class Program
{
static void Main(string[] args)
{
IPresentationConverter converter = new PresentationConverter();
ILicenseManager licenseManager = converter.LicenseManager;
try
{
licenseManager.LicenseKey = "5AHKK-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX";
licenseManager.LicenseActivationCode = "Qoioxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=";
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
Console.WriteLine("License is " + (licenseManager.LicenseIsActivated ? "" : "not ") + "activated.");
string licenseType = "";
switch (licenseManager.LicenseType)
{
case LicenseType.LT_NONE:
licenseType = "None";
break;
case LicenseType.LT_OEM:
licenseType = "OEM";
break;
case LicenseType.LT_OEM_NA:
licenseType = "OEM, no activation needed";
break;
case LicenseType.LT_TRIAL:
licenseType = "Trial";
break;
}
Console.WriteLine("License type: " + licenseType);
}
}
}
C#