LicenseProvider LicenseProvider LicenseProvider LicenseProvider Class

Definition

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
Inheritance
LicenseProviderLicenseProviderLicenseProviderLicenseProvider
Derived

Examples

En el ejemplo de código siguiente se crea un control con licencia mediante el Validate método.The following code example creates a licensed control using the Validate method. Usa un LicenseProvider que se implementa mediante el 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
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

Notes to Inheritors

Al heredar de LicenseProvider, debe invalidar el GetLicense(LicenseContext, Type, Object, Boolean) método. Consulte LicFileLicenseProvider para una implementación de esta clase. Para obtener más información acerca de las licencias, consulte Cómo: licencia de componentes y controles.

When you inherit from LicenseProvider, you must override the GetLicense(LicenseContext, Type, Object, Boolean) method. See LicFileLicenseProvider for an implementation of this class. For more information on licensing, see How to: License Components and Controls.

Constructors

LicenseProvider() LicenseProvider() LicenseProvider() LicenseProvider()

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

Methods

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

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

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

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

(Inherited from Object)
GetLicense(LicenseContext, Type, Object, Boolean) GetLicense(LicenseContext, Type, Object, Boolean) GetLicense(LicenseContext, Type, Object, Boolean) 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() GetType() GetType() GetType()

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

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

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

(Inherited from Object)
ToString() ToString() ToString() ToString()

Devuelve una cadena que representa el objeto actual. Returns a string that represents the current object.

(Inherited from Object)

Applies to

See Also