LicenseManager 클래스

정의

라이선스를 구성 요소에 추가하고 LicenseProvider를 관리하기 위한 속성과 메서드를 제공합니다. 이 클래스는 상속될 수 없습니다.

public ref class LicenseManager sealed
public sealed class LicenseManager
type LicenseManager = class
Public NotInheritable Class LicenseManager
상속
LicenseManager

예제

다음 코드 예제를 사용 하 여 사용이 허가 된 컨트롤을 만듭니다는 Validate 메서드. 클래스에서 LicenseProvider 구현하는 을 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;
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;
         }
      }
   }
}
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

설명

클래스는 LicenseManagerstaticUsageMode속성을 CurrentContext 제공합니다. 클래스는 , IsValidValidate메서드CreateWithContext도 제공합니다static.

라이선스를 부여하려는 구성 요소를 만들 때 다음을 수행해야 합니다.

  1. LicenseProvider 구성 요소를 로 표시하여 을 지정합니다LicenseProviderAttribute.

  2. 구성 요소의 생성자에서 또는 IsValid 를 호출 Validate 합니다. Validate는 유효한 라이선스 없이 instance 만들려고 할 때 을 throw합니다LicenseException. IsValid 는 예외를 throw하지 않습니다.

  3. 구성 요소가 삭제되거나 종료될 때 부여되는 모든 라이선스에 대해 를 호출 Dispose 합니다.

라이선스에 대한 자세한 내용은 방법: 라이선스 구성 요소 및 컨트롤을 참조하세요.

속성

CurrentContext

라이선스가 있는 개체를 사용할 수 있는 시기를 지정하는 현재 LicenseContext를 가져오거나 설정합니다.

UsageMode

LicenseUsageMode에 대해 라이선스가 있는 개체를 사용할 수 있는 시기를 지정하는 CurrentContext를 가져옵니다.

메서드

CreateWithContext(Type, LicenseContext)

라이선스가 있는 인스턴스를 사용할 수 있는 컨텍스트를 지정하여, 지정된 형식의 인스턴스를 만듭니다.

CreateWithContext(Type, LicenseContext, Object[])

라이선스가 있는 인스턴스를 사용할 수 있는 컨텍스트를 지정하여, 지정된 인수가 포함된 지정된 형식의 인스턴스를 만듭니다.

Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
IsLicensed(Type)

지정된 형식에 유효한 라이선스가 있는지 여부를 반환합니다.

IsValid(Type)

지정된 형식에 대해 유효한 라이선스를 부여할 수 있는지 여부를 확인합니다.

IsValid(Type, Object, License)

지정된 형식 인스턴스에 대해 유효한 라이선스를 부여할 수 있는지 여부를 확인합니다. 이 메서드는 유효한 License를 만듭니다.

LockContext(Object)

지정된 개체의 현재 LicenseContext를 변경하지 못하도록 합니다.

MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)
UnlockContext(Object)

지정된 개체의 현재 LicenseContext를 변경할 수 있도록 합니다.

Validate(Type)

지정된 형식에 대해 라이선스를 부여할 수 있는지 여부를 확인합니다.

Validate(Type, Object)

지정된 형식의 인스턴스에 대해 라이선스를 부여할 수 있는지 여부를 확인합니다.

적용 대상

추가 정보