<SerializableAttribute> _ Public NotInheritable Class NoLicenseException _ Inherits LicenseException _ Implements ISerializable
[SerializableAttribute] public sealed class NoLicenseException : LicenseException, ISerializable
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.
The NoLicenseException can be caught be the protected class and used to determine why a valid license could not be obtained. Normally this information is presented automatically to the user however it can be disabled by setting the ShowFinalErrorReport property to false.
Imports DeployLX.Licensing.v5
...
Try
_license = SecureLicenseManager.Validate(Me, Nothing, Nothing)
Catch ex As NoLicenseException
' A valid license was not found.
Dim unlocked As Boolean = False
For Each license As SecureLicense In ex.CheckedLicenses
If license.CanUnlockBySerial AndAlso license.IsUnlocked Then
unlocked = True
Exit For
End If
Next license
' Make some assumptions about the possible errors, could check ValidationRecords
' for the exact cause(s).
If unlocked Then
' The user has entered a serial number but something else caused the license validation
' to fail so display the actual error message to the user.
MessageBox.Show(ex.Message)
Else
' Still in trial mode so probably expired.
MessageBox.Show("Please visit http://www.xheo.com to purchase a license.")
End If
End Try
using DeployLX.Licensing.v5;
...
try
{
_license = SecureLicenseManager.Validate( this, null, null );
}
catch( NoLicenseException ex )
{
// A valid license was not found.
bool unlocked = false;
foreach( SecureLicense license in ex.CheckedLicenses )
{
if( license.CanUnlockBySerial && license.IsUnlocked )
{
unlocked = true;
break;
}
}
// Make some assumptions about the possible errors, could check ValidationRecords
// for the exact cause(s).
if( unlocked )
// The user has entered a serial number but something else caused the license validation
// to fail so display the actual error message to the user.
MessageBox.Show( ex.Message );
else
// Still in trial mode so probably expired.
MessageBox.Show( "Please visit http://www.xheo.com to purchase a license." );
}
Assembly: DeployLX.Licensing.v5 (in DeployLX.Licensing.v5.dll)