LicenseProvider Klasse

Definition

Stellt die abstract-Basisklasse für die Implementierung eines Lizenzgebers bereit.

public ref class LicenseProvider abstract
public abstract class LicenseProvider
type LicenseProvider = class
Public MustInherit Class LicenseProvider
Vererbung
LicenseProvider
Abgeleitet

Beispiele

Im folgenden Codebeispiel wird mithilfe der Validate Methode ein lizenziertes Steuerelement erstellt. Es verwendet eine LicenseProvider , die von der LicFileLicenseProvider Klasse implementiert wird.

// 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 für Ausführende

Wenn Sie von erben LicenseProvider, müssen Sie die GetLicense(LicenseContext, Type, Object, Boolean) Methode außer Kraft setzen.

Eine Implementierung dieser Klasse finden Sie unter LicFileLicenseProvider Weitere Informationen zur Lizenzierung finden Sie unter How to: License Components and Controls.

Konstruktoren

LicenseProvider()

Initialisiert eine neue Instanz der LicenseProvider-Klasse.

Methoden

Equals(Object)

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

(Geerbt von Object)
GetHashCode()

Fungiert als Standardhashfunktion.

(Geerbt von Object)
GetLicense(LicenseContext, Type, Object, Boolean)

Ruft beim Überschreiben in einer abgeleiteten Klasse eine Lizenz für eine Instanz oder einen Typ einer Komponente ab, wenn ein Kontext vorhanden und angegeben ist, ob bei einer Lizenzverweigerung eine Ausnahme ausgelöst wird.

GetType()

Ruft den Type der aktuellen Instanz ab.

(Geerbt von Object)
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

Siehe auch