Leadtools Namespace > RasterSupport Class : SetLicenseAsync Method |
public static IAsyncAction SetLicenseAsync( IRandomAccessStream licenseStream, string developerKey )
'Declaration Public Shared Function SetLicenseAsync( _ ByVal licenseStream As IRandomAccessStream, _ ByVal developerKey As String _ ) As IAsyncAction
'Usage Dim licenseStream As IRandomAccessStream Dim developerKey As String Dim value As IAsyncAction value = RasterSupport.SetLicenseAsync(licenseStream, developerKey)
public static IAsyncAction SetLicenseAsync( IRandomAccessStream licenseStream, string developerKey )
function Leadtools.RasterSupport.SetLicenseAsync( licenseStream , developerKey )
public: static IAsyncAction^ SetLicenseAsync( IRandomAccessStream^ licenseStream, String^ developerKey )
You must use this function to set the runtime license for LEADTOOLS and to unlock support for any optional features that you have licensed. If you do not set a runtime license, your application will display a "nag" message dialog at runtime, indicating that you have developed the application without a valid runtime license.
In order to obtain a runtime license and developer key, you must contact LEAD. For more information, refer to About LEADTOOLS Runtime Licenses.
For information about LEADTOOLS Document/Medical capabilities, contact LEAD.
To determine if support for optional features has been unlocked, use IsLocked
using Leadtools; using Leadtools.Codecs; using Leadtools.ImageProcessing; public void SetLicenseAsyncExample() { IStorageFolder packageLocation = Windows.ApplicationModel.Package.Current.InstalledLocation; var licStorageFile = packageLocation.GetFileAsync(@"Assets\" + MY_LICENSE_FILE2); licStorageFile.Completed = delegate(IAsyncOperation<StorageFile> storageFileOperation, AsyncStatus storageFileStatus) { if (storageFileStatus == AsyncStatus.Completed) { var licRAS = storageFileOperation.GetResults().OpenAsync(FileAccessMode.Read); licRAS.Completed = delegate(IAsyncOperation<IRandomAccessStream> licRASOperation, AsyncStatus licRASStatus) { if (licRASStatus == AsyncStatus.Completed) { var setLicense = RasterSupport.SetLicenseAsync(licRASOperation.GetResults(), MY_DEVELOPER_KEY2); setLicense.Completed = delegate(IAsyncAction setLicenseAction, AsyncStatus setLicenseStatus) { if (setLicenseStatus == AsyncStatus.Completed) { bool isLocked = RasterSupport.IsLocked(RasterSupportType.Document); if (isLocked) Debug.WriteLine("Document support is locked"); else Debug.WriteLine("Document support is unlocked"); Assert.IsTrue(!isLocked); } else { RasterException rasterEx = RasterException.FromHResult(setLicenseAction.ErrorCode.HResult); string message = setLicenseAction.ErrorCode.Message; if (rasterEx != null) message = rasterEx.Message; Debug.WriteLine(message); Assert.IsTrue(false); } }; } else { Debug.WriteLine(licRASOperation.ErrorCode.Message); Assert.IsTrue(false); } }; } else { Debug.WriteLine(storageFileOperation.ErrorCode.Message); Assert.IsTrue(false); } }; }