LicFileLicenseProvider 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.
Egy .LicenseProvider A szolgáltató a Microsoft .NET Framework standard licencelési modelljéhez hasonlóan működik.
public ref class LicFileLicenseProvider : System::ComponentModel::LicenseProvider
public class LicFileLicenseProvider : System.ComponentModel.LicenseProvider
type LicFileLicenseProvider = class
inherit LicenseProvider
Public Class LicFileLicenseProvider
Inherits LicenseProvider
- Öröklődés
Példák
Az alábbi példa egy licenccel rendelkező vezérlőt hoz létre a Validate metódus használatával. A licenckezelőhöz használja LicFileLicenseProvider .
// 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 LicFileLicenseProvider ajánlatok GetLicense és IsKeyValid módszerek. A IsKeyValid metódus határozza meg, hogy a LicenseKey metódus által GetLicense lekért adatok érvényesek-e. Ha ebből az osztályból örököl, felülbírálhatja a metódust IsKeyValid , hogy saját érvényesítési logikát biztosítson.
Ez az osztály hasonló licencelési funkciókat biztosít a COM-licenceléshez, és szöveges licencfájlokat használ.
A licenceléssel kapcsolatos további információkért lásd: Licencösszetevők és -vezérlők.
Konstruktorok
| Name | Description |
|---|---|
| LicFileLicenseProvider() |
Inicializálja a LicFileLicenseProvider 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) |
| GetKey(Type) |
A megadott típus kulcsát adja vissza. |
| GetLicense(LicenseContext, Type, Object, Boolean) |
Az összetevő példányának licencét adja vissza, ha van ilyen. |
| GetType() |
Lekéri az Type aktuális példányt. (Öröklődés forrása Object) |
| IsKeyValid(String, Type) |
Meghatározza, hogy a metódus által GetLicense(LicenseContext, Type, Object, Boolean) lekért kulcs érvényes-e a megadott típusra. |
| 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) |