Public Shared Function Validate ( _ instance As Object, _ type As Type, _ requestInfo As LicenseValidationRequestInfo _ ) As SecureLicense
public static SecureLicense Validate( Object instance, Type type, LicenseValidationRequestInfo requestInfo )
The Validate method searches the user's machine for a license and attempts to validate the Limits. If no license can be found an exception is thrown which will halt the use of the component or can be caught and displayed to the user.
Note If the protected class will be inherited by another class in a different assembly you should pass a value for the type specifying the type of the protected class.
You can check for a license in your class by calling the Validate(Object, Type, LicenseValidationRequestInfo) method as in the following code.
Imports Microsoft.VisualBasic
Imports System
Imports System.Windows.Forms
Imports DeployLX.Licensing.v5
Namespace VBProtectedDll
Public Class ProtectedClass
Private _license As SecureLicense
Public Sub New()
_license = SecureLicenseManager.Validate(Me, Nothing, Nothing)
End Sub
Public Sub DoSomething()
If _license.IsTrial Then
MessageBox.Show("Hello from ProtectedClass, enjoy the trial.")
Else
MessageBox.Show("Hello from ProtectedClass, thanks for your purchase.")
End If
End Sub
End Class
End Namespace
using System;
using System.Windows.Forms;
using DeployLX.Licensing.v5;
namespace CSharpProtectedDll
{
public class ProtectedClass
{
private SecureLicense _license;
public ProtectedClass()
{
_license = SecureLicenseManager.Validate( this, null, null );
}
public void DoSomething( )
{
if( _license.IsTrial )
MessageBox.Show( "Hello from ProtectedClass, enjoy the trial." );
else
MessageBox.Show( "Hello from ProtectedClass, thanks for your purchase." );
}
}
}
Exception | Condition |
---|---|
DeployLX.Licensing.v5..::..NoLicenseException | Thrown when no valid license could be found. Check the ValidationRecords collection for a list of errors that occurred during validation. Check the CheckedLicenses collection for a list of licenses that were tried. |
DeployLX.Licensing.v5..::..SecureLicenseException | Thrown when there is an internal unhandled exception while searching for a valid license. |
Assembly: DeployLX.Licensing.v5 (in DeployLX.Licensing.v5.dll)