LicFileLicenseProvider Klasse

Definition

Stellt eine Implementierung eines LicenseProvider bereit. Die Funktionsweise des Lizenzgebers weist große Ähnlichkeit mit der des Standardlizenzierungsmodells von Microsoft .NET Framework auf.

public ref class LicFileLicenseProvider : System::ComponentModel::LicenseProvider
public class LicFileLicenseProvider : System.ComponentModel.LicenseProvider
type LicFileLicenseProvider = class
    inherit LicenseProvider
Public Class LicFileLicenseProvider
Inherits LicenseProvider
Vererbung
LicFileLicenseProvider

Beispiele

Im folgenden Beispiel wird mithilfe der Validate -Methode ein lizenziertes Steuerelement erstellt. Es wird für den Lizenz-Manager verwendet LicFileLicenseProvider .

// Adds the LicenseProviderAttribute to the control.

[LicenseProvider(LicFileLicenseProvider::typeid)]
public ref class MyControl: public Control
{
   // Creates a new, null license.
private:
   License^ license;

public:
   MyControl()
   {
      
      // Adds Validate to the control's constructor.
      license = LicenseManager::Validate( MyControl::typeid, this );

      // Insert code to perform other instance creation tasks here.
   }

public:
   ~MyControl()
   {
      if ( license != nullptr )
      {
         delete license;
         license = nullptr;
      }
   }
};
using System;
using System.ComponentModel;
using System.Windows.Forms;

// Adds the LicenseProviderAttribute to the control.
[LicenseProvider(typeof(LicFileLicenseProvider))]
public class MyControl : Control 
{
 
   // Creates a new, null license.
   private License license = null;
 
   public MyControl () 
   {
 
      // Adds Validate to the control's constructor.
      license = LicenseManager.Validate(typeof(MyControl), this);
 
      // Insert code to perform other instance creation tasks here.
   }
 
   protected override void Dispose(bool disposing) 
   {
      if(disposing)
      {
         if (license != null) 
         {
            license.Dispose();
            license = null;
         }
      }
   }
}
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

Hinweise

Die LicFileLicenseProvider -Angebote GetLicense und IsKeyValid -Methoden. Die IsKeyValid -Methode bestimmt, ob das LicenseKey von der GetLicense -Methode abgerufene gültig ist. Wenn Sie von dieser Klasse erben, können Sie die IsKeyValid -Methode überschreiben, um Ihre eigene Validierungslogik bereitzustellen.

Diese Klasse ist vorhanden, um ähnliche Lizenzierungsfunktionen wie die COM-Lizenzierung bereitzustellen, und verwendet Textlizenzdateien.

Weitere Informationen zur Lizenzierung finden Sie unter Vorgehensweise: Lizenzieren von Komponenten und Steuerelementen.

Konstruktoren

LicFileLicenseProvider()

Initialisiert eine neue Instanz der LicFileLicenseProvider-Klasse.

Methoden

Equals(Object)

Bestimmt, ob das angegebene Objekt gleich dem aktuellen Objekt ist.

(Geerbt von Object)
GetHashCode()

Fungiert als Standardhashfunktion.

(Geerbt von Object)
GetKey(Type)

Gibt einen Schlüssel für den angegebenen Typ zurück.

GetLicense(LicenseContext, Type, Object, Boolean)

Gibt eine ggf. verfügbare Lizenz für die Instanz der Komponente zurück.

GetType()

Ruft den Type der aktuellen Instanz ab.

(Geerbt von Object)
IsKeyValid(String, Type)

Bestimmt, ob der durch die GetLicense(LicenseContext, Type, Object, Boolean)-Methode abgerufene Schlüssel für den angegebenen Typ gültig ist.

MemberwiseClone()

Erstellt eine flache Kopie des aktuellen Object.

(Geerbt von Object)
ToString()

Gibt eine Zeichenfolge zurück, die das aktuelle Objekt darstellt.

(Geerbt von Object)

Gilt für:

Weitere Informationen