Freigeben über


LicenseProvider Klasse

Definition

Stellt die Basisklasse für die abstract Implementierung eines Lizenzanbieters 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 von der LicFileLicenseProvider Klasse implementierte.

// 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.ComponentModel;
using System.Windows.Forms;

// Adds the LicenseProviderAttribute to the control.
[LicenseProvider(typeof(LicFileLicenseProvider))]
public class MyControl : Control
{
    // Creates a new, null license.
    License license;

    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 LicenseProvidererben, müssen Sie die GetLicense(LicenseContext, Type, Object, Boolean) Methode überschreiben.

Eine Implementierung dieser Klasse finden Sie unter.See LicFileLicenseProvider for an implementation of this class.

Konstruktoren

Name Beschreibung
LicenseProvider()

Initialisiert eine neue Instanz der LicenseProvider-Klasse.

Methoden

Name Beschreibung
Equals(Object)

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

(Geerbt von Object)
GetHashCode()

Dient als die Standard-Hashfunktion

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

Wenn eine abgeleitete Klasse überschrieben wird, ruft eine Lizenz für eine Instanz oder einen Komponententyp ab, wenn ein Kontext angegeben wird und ob die Verweigerung einer Lizenz eine Ausnahme auslöst.

GetType()

Ruft die Type der aktuellen Instanz ab.

(Geerbt von Object)
MemberwiseClone()

Erstellt eine flache Kopie der aktuellen Object.

(Geerbt von Object)
ToString()

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

(Geerbt von Object)

Gilt für:

Weitere Informationen