LicenseProvider Clase

Definición

Proporciona la clase base abstract para implementar un proveedor de licencia.Provides the abstract base class for implementing a license provider.

public ref class LicenseProvider abstract
public abstract class LicenseProvider
type LicenseProvider = class
Public MustInherit Class LicenseProvider
Herencia
LicenseProvider
Derivado

Ejemplos

En el ejemplo de código siguiente se crea un control Validate con licencia mediante el método.The following code example creates a licensed control using the Validate method. Utiliza un LicenseProvider implementado por la LicFileLicenseProvider clase.It uses a LicenseProvider that is implemented by the LicFileLicenseProvider class.

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

Notas a los implementadores

Al heredar de LicenseProvider, debe reemplazar el GetLicense(LicenseContext, Type, Object, Boolean) método.When you inherit from LicenseProvider, you must override the GetLicense(LicenseContext, Type, Object, Boolean) method.

Vea LicFileLicenseProvider para obtener una implementación de esta clase.See LicFileLicenseProvider for an implementation of this class. Para obtener más información sobre las licencias, consulte Cómo: Componentes y controlesde licencia.For more information on licensing, see How to: License Components and Controls.

Constructores

LicenseProvider()

Inicializa una nueva instancia de la clase LicenseProvider.Initializes a new instance of the LicenseProvider class.

Métodos

Equals(Object)

Determina si el objeto especificado es igual al objeto actual.Determines whether the specified object is equal to the current object.

(Heredado de Object)
GetHashCode()

Sirve como función hash predeterminada.Serves as the default hash function.

(Heredado de Object)
GetLicense(LicenseContext, Type, Object, Boolean)

Cuando se reemplaza en una clase derivada, obtiene una licencia para una instancia o un tipo de componente con un contexto dado y si la denegación de una licencia produce una excepción.When overridden in a derived class, gets a license for an instance or type of component, when given a context and whether the denial of a license throws an exception.

GetType()

Obtiene el Type de la instancia actual.Gets the Type of the current instance.

(Heredado de Object)
MemberwiseClone()

Crea una copia superficial del Object actual.Creates a shallow copy of the current Object.

(Heredado de Object)
ToString()

Devuelve un valor de tipo string que representa el objeto actual.Returns a string that represents the current object.

(Heredado de Object)

Se aplica a

Consulte también: