LicFileLicenseProvider クラス

定義

LicenseProviderの実装を提供します。 プロバイダーは、Microsoft .NET Framework 標準ライセンス モデルと同様の方法で動作します。

public ref class LicFileLicenseProvider : System::ComponentModel::LicenseProvider
public class LicFileLicenseProvider : System.ComponentModel.LicenseProvider
type LicFileLicenseProvider = class
    inherit LicenseProvider
Public Class LicFileLicenseProvider
Inherits LicenseProvider
継承
LicFileLicenseProvider

次の例では、 Validate メソッドを使用してライセンスされたコントロールを作成します。 ライセンス マネージャーの 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

注釈

LicFileLicenseProviderでは、GetLicenseメソッドとIsKeyValidメソッドが提供されます。 IsKeyValid メソッドは、GetLicense メソッドによって取得されたLicenseKeyが有効かどうかを判断します。 このクラスから継承する場合は、 IsKeyValid メソッドをオーバーライドして、独自の検証ロジックを提供できます。

このクラスは、COM ライセンスと同様のライセンス機能を提供するために存在し、テキスト ライセンス ファイルを使用します。

コンストラクター

名前 説明
LicFileLicenseProvider()

LicFileLicenseProvider クラスの新しいインスタンスを初期化します。

メソッド

名前 説明
Equals(Object)

指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetKey(Type)

指定した型のキーを返します。

GetLicense(LicenseContext, Type, Object, Boolean)

コンポーネントのインスタンスのライセンス (使用可能な場合) を返します。

GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
IsKeyValid(String, Type)

GetLicense(LicenseContext, Type, Object, Boolean) メソッドが取得するキーが、指定した型に対して有効かどうかを判断します。

MemberwiseClone()

現在の Objectの簡易コピーを作成します。

(継承元 Object)
ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

適用対象

こちらもご覧ください