LicFileLicenseProvider Klasa

Definicja

Zapewnia implementację elementu LicenseProvider. Dostawca działa w podobny sposób do standardowego modelu licencjonowania microsoft .NET Framework.

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

Przykłady

Poniższy przykład tworzy licencjonowany formant przy użyciu Validate metody . Jest on używany LicFileLicenseProvider dla menedżera licencji.

// 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

Uwagi

GetLicense Oferty LicFileLicenseProvider i IsKeyValid metody. Metoda IsKeyValid określa, czy LicenseKey metoda pobrana przez metodę GetLicense jest prawidłowa. Po dziedziczeniu z tej klasy można zastąpić metodę IsKeyValid w celu zapewnienia własnej logiki walidacji.

Ta klasa istnieje, aby zapewnić podobne funkcje licencjonowania do licencjonowania MODELU COM i używa plików licencji tekstowych.

Aby uzyskać więcej informacji na temat licencjonowania, zobacz Instrukcje: składniki licencji i kontrolki.

Konstruktory

LicFileLicenseProvider()

Inicjuje nowe wystąpienie klasy LicFileLicenseProvider.

Metody

Equals(Object)

Określa, czy dany obiekt jest taki sam, jak bieżący obiekt.

(Odziedziczone po Object)
GetHashCode()

Służy jako domyślna funkcja skrótu.

(Odziedziczone po Object)
GetKey(Type)

Zwraca klucz dla określonego typu.

GetLicense(LicenseContext, Type, Object, Boolean)

Zwraca licencję dla wystąpienia składnika, jeśli jest dostępny.

GetType()

Type Pobiera bieżące wystąpienie.

(Odziedziczone po Object)
IsKeyValid(String, Type)

Określa, czy klucz pobierany GetLicense(LicenseContext, Type, Object, Boolean) przez metodę jest prawidłowy dla określonego typu.

MemberwiseClone()

Tworzy płytkią kopię bieżącego Objectelementu .

(Odziedziczone po Object)
ToString()

Zwraca ciąg reprezentujący bieżący obiekt.

(Odziedziczone po Object)

Dotyczy

Zobacz też