DeployLX Software Protection System

NoLicenseException Class

Exception thrown when no license can be found.

Syntax

<SerializableAttribute> _
Public NotInheritable Class NoLicenseException _
	Inherits LicenseException _
	Implements ISerializable
[SerializableAttribute]
public sealed class NoLicenseException : LicenseException, 
	ISerializable

Remarks

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.

Examples

This sample demonstrates how to catch the NoLicenseException and process the error.
Visual Basic
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
C#
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." );
}

Inheritance Hierarchy

System..::..Object
  System..::..Exception
    System..::..SystemException
      System.ComponentModel..::..LicenseException
        DeployLX.Licensing.v5..::..NoLicenseException

Assembly:  DeployLX.Licensing.v5 (in DeployLX.Licensing.v5.dll)

See Also