LicFileLicenseProvider クラス
アセンブリ: System (system.dll 内)
構文
解説
LicFileLicenseProvider は GetLicense メソッドと IsKeyValid メソッドを提供します。IsKeyValid メソッドは、GetLicense メソッドによって取得された LicenseKey が有効かどうかを判断します。このクラスから継承する場合は、IsKeyValid メソッドをオーバーライドして独自の検証ロジックを用意できます。
このクラスは、COM のライセンス機能に類似したライセンス機能を提供するためのクラスで、テキスト形式のライセンス ファイルを使用します。
Validate メソッドを使用して、ライセンスされたコントロールを作成する例を次に示します。ライセンス マネージャのために LicFileLicenseProvider を使用します。
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 Not (license Is Nothing) Then license.Dispose() license = Nothing End If End If End Sub End Class
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; } } } }
// 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; } } };
import System.*; import System.ComponentModel.*; import System.Windows.Forms.*; // Adds the LicenseProviderAttribute to the control. /** @attribute LicenseProvider(LicFileLicenseProvider.class) */ public class MyControl extends Control { // Creates a new, null license. private License license = null; public MyControl() { // Adds Validate to the control's constructor. license = LicenseManager.Validate(MyControl.class.ToType(), this); // Insert code to perform other instance creation tasks here. } protected void Dispose(boolean disposing) { if (disposing) { if (license != null) { license.Dispose(); license = null; } } } }
System.ComponentModel.LicenseProvider
System.ComponentModel.LicFileLicenseProvider
プラットフォーム
Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
参照
- LicFileLicenseProvider クラスのページへのリンク