LicFileLicenseProvider Classe
Definição
Fornece uma implementação de um LicenseProvider.Provides an implementation of a LicenseProvider. O provedor funciona de maneira semelhante ao modelo de licenciamento padrão do Microsoft .NET Framework.The provider works in a similar fashion to the Microsoft .NET Framework standard licensing model.
public ref class LicFileLicenseProvider : System::ComponentModel::LicenseProvider
public class LicFileLicenseProvider : System.ComponentModel.LicenseProvider
type LicFileLicenseProvider = class
inherit LicenseProvider
Public Class LicFileLicenseProvider
Inherits LicenseProvider
- Herança
Exemplos
O exemplo a seguir cria um controle licenciado usando o Validate método.The following example creates a licensed control using the Validate method. Ele usa LicFileLicenseProvider para o Gerenciador de licenças.It uses LicFileLicenseProvider for the license manager.
// 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
Comentários
As LicFileLicenseProvider ofertas GetLicense e os IsKeyValid métodos.The LicFileLicenseProvider offers GetLicense and IsKeyValid methods. O IsKeyValid método determina se o LicenseKey recuperado pelo GetLicense método é válido.The IsKeyValid method determines whether the LicenseKey retrieved by the GetLicense method is valid. Ao herdar dessa classe, você pode substituir o IsKeyValid método para fornecer sua própria lógica de validação.When you inherit from this class, you can override the IsKeyValid method to provide your own validation logic.
Essa classe existe para fornecer funcionalidade de licenciamento semelhante para licenciamento COM e usa arquivos de licença de texto.This class exists to provide similar licensing functionality to COM licensing and uses text license files.
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
| LicFileLicenseProvider() |
Inicializa uma nova instância da classe LicFileLicenseProvider.Initializes a new instance of the LicFileLicenseProvider 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) |
| GetKey(Type) |
Retorna uma chave para o tipo especificado.Returns a key for the specified type. |
| GetLicense(LicenseContext, Type, Object, Boolean) |
Retornará uma licença para a instância do componente, se houver uma disponível.Returns a license for the instance of the component, if one is available. |
| GetType() |
Obtém o Type da instância atual.Gets the Type of the current instance. (Herdado de Object) |
| IsKeyValid(String, Type) |
Determina se a chave que o método GetLicense(LicenseContext, Type, Object, Boolean) recupera é válida para o tipo especificado.Determines whether the key that the GetLicense(LicenseContext, Type, Object, Boolean) method retrieves is valid for the specified type. |
| 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) |