次の方法で共有


LicenseProvider クラス

定義

ライセンス プロバイダーを実装するための abstract 基本クラスを提供します。

public ref class LicenseProvider abstract
public abstract class LicenseProvider
type LicenseProvider = class
Public MustInherit Class LicenseProvider
継承
LicenseProvider
派生

次のコード例では、 Validate メソッドを使用してライセンスコントロールを作成します。 LicFileLicenseProvider クラスによって実装されるLicenseProviderを使用します。

// 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

注意 (実装者)

LicenseProviderから継承する場合は、GetLicense(LicenseContext, Type, Object, Boolean) メソッドをオーバーライドする必要があります。

このクラスの実装については、 LicFileLicenseProvider を参照してください。

コンストラクター

名前 説明
LicenseProvider()

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

メソッド

名前 説明
Equals(Object)

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

(継承元 Object)
GetHashCode()

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

(継承元 Object)
GetLicense(LicenseContext, Type, Object, Boolean)

派生クラスでオーバーライドされた場合は、コンテキストが指定されたときに、インスタンスまたはコンポーネントの種類のライセンスを取得し、ライセンス拒否が例外をスローするかどうかを取得します。

GetType()

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

(継承元 Object)
MemberwiseClone()

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

(継承元 Object)
ToString()

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

(継承元 Object)

適用対象

こちらもご覧ください