SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components

0
0

Where do I call SetRuntimeLicenseKey in a C# DLL?

Dan Kary

Version
4.0.6.8482
  • You must to post comments
1
0

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

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.