LicenseProvider Osztály
Definíció
Fontos
Egyes információk olyan, kiadás előtti termékekre vonatkoznak, amelyek a kiadásig még jelentősen módosulhatnak. A Microsoft nem vállal kifejezett vagy törvényi garanciát az itt megjelenő információért.
Megadja a abstract licencszolgáltató implementálásának alaposztályát.
public ref class LicenseProvider abstract
public abstract class LicenseProvider
type LicenseProvider = class
Public MustInherit Class LicenseProvider
- Öröklődés
-
LicenseProvider
- Származtatott
Példák
Az alábbi példakód egy licenccel rendelkező vezérlőt hoz létre a Validate metódus használatával. Az osztály által LicenseProvider implementáltat LicFileLicenseProvider használja.
// 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.ComponentModel;
using System.Windows.Forms;
// Adds the LicenseProviderAttribute to the control.
[LicenseProvider(typeof(LicFileLicenseProvider))]
public class MyControl : Control
{
// Creates a new, null license.
License license;
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
Megjegyzések az implementálókhoz
Ha örököl, LicenseProviderfelül kell bírálnia a metódust GetLicense(LicenseContext, Type, Object, Boolean) .
Tekintse meg LicFileLicenseProvider az osztály implementációját. A licenceléssel kapcsolatos további információkért lásd: Licencösszetevők és -vezérlők.
Konstruktorok
| Name | Description |
|---|---|
| LicenseProvider() |
Inicializálja a LicenseProvider osztály új példányát. |
Metódusok
| Name | Description |
|---|---|
| Equals(Object) |
Meghatározza, hogy a megadott objektum egyenlő-e az aktuális objektummal. (Öröklődés forrása Object) |
| GetHashCode() |
Ez az alapértelmezett kivonatoló függvény. (Öröklődés forrása Object) |
| GetLicense(LicenseContext, Type, Object, Boolean) |
Ha egy származtatott osztályban felül van bírálva, egy példányhoz vagy összetevőtípushoz kap licencet, ha adott kontextust ad meg, és hogy a licenc megtagadása kivételt eredményez-e. |
| GetType() |
Lekéri az Type aktuális példányt. (Öröklődés forrása Object) |
| MemberwiseClone() |
Az aktuális Objectpéldány sekély másolatát hozza létre. (Öröklődés forrása Object) |
| ToString() |
Az aktuális objektumot jelképező sztringet ad vissza. (Öröklődés forrása Object) |