LicFileLicenseProvider Clase

Definición

Proporciona una implementación de un LicenseProvider. El proveedor funciona de forma similar al modelo de licencias estándar de 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
Herencia
LicFileLicenseProvider

Ejemplos

En el ejemplo siguiente se crea un control con licencia mediante el Validate método . LicFileLicenseProvider Usa para el administrador de licencias.

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

Comentarios

GetLicense Ofertas LicFileLicenseProvider y IsKeyValid métodos. El IsKeyValid método determina si el LicenseKey objeto recuperado por el GetLicense método es válido. Cuando hereda de esta clase, puede invalidar el IsKeyValid método para proporcionar su propia lógica de validación.

Esta clase existe para proporcionar una funcionalidad de licencia similar a las licencias COM y usa archivos de licencia de texto.

Para obtener más información sobre las licencias, vea How to: License Components and Controls.

Constructores

LicFileLicenseProvider()

Inicializa una nueva instancia de la clase LicFileLicenseProvider.

Métodos

Equals(Object)

Determina si el objeto especificado es igual que el objeto actual.

(Heredado de Object)
GetHashCode()

Sirve como la función hash predeterminada.

(Heredado de Object)
GetKey(Type)

Devuelve una clave para el tipo especificado.

GetLicense(LicenseContext, Type, Object, Boolean)

Devuelve una licencia para la instancia del componente si está disponible.

GetType()

Obtiene el Type de la instancia actual.

(Heredado de Object)
IsKeyValid(String, Type)

Determina si la clave recuperada por el método GetLicense(LicenseContext, Type, Object, Boolean) es válida para el tipo especificado.

MemberwiseClone()

Crea una copia superficial del Object actual.

(Heredado de Object)
ToString()

Devuelve una cadena que representa el objeto actual.

(Heredado de Object)

Se aplica a

Consulte también