다음을 통해 공유


LicenseManager 클래스

정의

구성 요소 LicenseProvider에 라이선스를 추가하고 . 이 클래스는 상속할 수 없습니다.

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

예제

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

설명

클래스는 LicenseManager 다음과 같은 static 속성을 CurrentContextUsageMode제공합니다. 클래스는 다음 static 메서드도 제공합니다. CreateWithContextIsValidValidate

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

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

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

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

속성

Name Description
CurrentContext

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

UsageMode

라이선스가 LicenseUsageMode 부여된 개체를 사용할 수 있는 시기를 지정하는 값을 CurrentContext가져옵니다.

메서드

Name Description
CreateWithContext(Type, LicenseContext, Object[])

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

CreateWithContext(Type, LicenseContext)

사용이 허가된 인스턴스를 사용할 수 있는 컨텍스트가 지정된 경우 지정된 형식의 인스턴스를 만듭니다.

Equals(Object)

지정한 개체와 현재 개체가 같은지 여부를 확인합니다.

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

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

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

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

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

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

IsValid(Type, Object, License)

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

IsValid(Type)

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

LockContext(Object)

지정된 개체의 현재 LicenseContext 변경 내용을 방지합니다.

MemberwiseClone()

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

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

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

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

지정된 개체의 현재 LicenseContext 내용을 변경할 수 있습니다.

Validate(Type, Object)

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

Validate(Type)

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

적용 대상

추가 정보