LicenseProvider Class
Assembly: System (in system.dll)
Note: |
|---|
| The HostProtectionAttribute attribute applied to this class has the following Resources property value: SharedState. The HostProtectionAttribute does not affect desktop applications (which are typically started by double-clicking an icon, typing a command, or entering a URL in a browser). For more information, see the HostProtectionAttribute class or SQL Server Programming and Host Protection Attributes. |
The following code example creates a licensed control using the Validate method. It uses a LicenseProvider that is implemented by the LicFileLicenseProvider class.
Imports System Imports System.ComponentModel Imports System.Windows.Forms ' Adds the LicenseProviderAttribute to the control. <LicenseProvider(GetType(LicFileLicenseProvider))> _ Public Class MyControl Inherits Control ' Creates a new, null license. Private license As License = Nothing Public Sub New() ' Adds Validate to the control's constructor. license = LicenseManager.Validate(GetType(MyControl), Me) ' Insert code to perform other instance creation tasks here. End Sub Protected Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If (license IsNot Nothing) Then license.Dispose() license = Nothing End If End If End Sub End Class
import System.*;
import System.ComponentModel.*;
import System.Windows.Forms.*;
// Adds the LicenseProviderAttribute to the control.
/** @attribute LicenseProvider(LicFileLicenseProvider.class)
*/
public class MyControl extends Control
{
// Creates a new, null license.
private License license = null;
public MyControl()
{
// Adds Validate to the control's constructor.
license = LicenseManager.Validate(MyControl.class.ToType(), this);
// Insert code to perform other instance creation tasks here.
}
protected void Dispose(boolean disposing)
{
if (disposing) {
if (license != null) {
license.Dispose();
license = null;
}
}
}
}
Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.
Note: