Where do I call SetRuntimeLicenseKey in a C# DLL?
Dan Kary
- Tony Carosa asked 8 years ago
- You must login to post comments
Hi Dan,
I know we’ve answered this as a support ticket, but for the benefit of the SciChart WPF Community, here is the answer:
As per our Activating SciChart article, the SciChartSurface.SetRuntimeLicenseKey() method needs to be called once, and once only before any SciChartSurface instance is created.
In multi-DLL applications or where you have Prism modules dynamically loaded, we recommend creating a class to handle license management and initializing licensing in the entry point to the module. For example:
// Declare such a class
public static class SciChartLicensingHelper
{
private static bool _isInit = false;
private static readonly object _syncRoot = new object();
public static void InitializeLicense()
{
lock(_syncRoot)
{
if (_isInit) return;
SciChartSurface.SetRuntimeLicenseKey(@"<YourLicenseKey>");
_isInit = true;
}
}
}
// Call in your module entry point as follows
SciChartLicensingHelper.InitalizeLicense();
Using this code you can call SciChartLicensingHelper.InitalizeLicense() as many times as you wish and it will be called only once. This should resolve any issues in multi-module or complex applications.
Best regards,
Andrew
- Andrew Burnett-Thompson answered 8 years ago
- You must login to post comments
Please login first to submit.