LicenseProvider Classe
Definição
Fornece a classe base abstract para implementar um provedor de licença.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
- Herança
-
LicenseProvider
- Derivado
Exemplos
O exemplo de código a seguir cria um controle licenciado usando o Validate método.The following code example creates a licensed control using the Validate method. Ele usa um LicenseProvider que é implementado pela LicFileLicenseProvider classe.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 aos Implementadores
Ao herdar do LicenseProvider , você deve substituir o GetLicense(LicenseContext, Type, Object, Boolean) método.When you inherit from LicenseProvider, you must override the GetLicense(LicenseContext, Type, Object, Boolean) method.
Consulte LicFileLicenseProvider para obter uma implementação desta classe.See LicFileLicenseProvider for an implementation of this class. Para obter mais informações sobre licenciamento, consulte como: licenciar componentes e controles.For more information on licensing, see How to: License Components and Controls.
Construtores
| LicenseProvider() |
Inicializa uma nova instância da classe LicenseProvider.Initializes a new instance of the LicenseProvider class. |
Métodos
| Equals(Object) |
Determina se o objeto especificado é igual ao objeto atual.Determines whether the specified object is equal to the current object. (Herdado de Object) |
| GetHashCode() |
Serve como a função de hash padrão.Serves as the default hash function. (Herdado de Object) |
| GetLicense(LicenseContext, Type, Object, Boolean) |
Quando substituído em uma classe derivada, obtém uma licença para uma instância ou um tipo de componente, quando é fornecido um contexto e se a negação de uma licença gera uma exceção.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() |
Obtém o Type da instância atual.Gets the Type of the current instance. (Herdado de Object) |
| MemberwiseClone() |
Cria uma cópia superficial do Object atual.Creates a shallow copy of the current Object. (Herdado de Object) |
| ToString() |
Retorna uma cadeia de caracteres que representa o objeto atual.Returns a string that represents the current object. (Herdado de Object) |