LEADTOOLS (Leadtools assembly)

SetLicenseAsync Method

Show in webframe
Example 







Leadtools.Junk.IRandomAccessStreamContaining the LEADTOOLS runtime license to load.
Character string containing the developer key.
Sets the runtime license for LEADTOOLS and unlocks support for optional features such as LEADTOOLS Imaging Pro, Document and Medical capabilities, or PDF support.
Syntax
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
) 

Parameters

licenseStream
Leadtools.Junk.IRandomAccessStreamContaining the LEADTOOLS runtime license to load.
developerKey
Character string containing the developer key.

Return Value

The asynchronous save operation object.
Remarks

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

Example
Copy Code  
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);
      }
   };
}
Requirements

Target Platforms

See Also

Reference

RasterSupport Class
RasterSupport Members

 

 


Products | Support | Contact Us | Copyright Notices

© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.