LicenseManager 클래스
구성 요소에 라이센스를 추가하고 LicenseProvider를 관리하는 속성 및 메서드를 제공합니다. 이 클래스는 상속될 수 없습니다.
네임스페이스: System.ComponentModel
어셈블리: System(system.dll)
구문
‘선언
Public NotInheritable Class LicenseManager
‘사용 방법
Dim instance As LicenseManager
public sealed class LicenseManager
public ref class LicenseManager sealed
public final class LicenseManager
public final class LicenseManager
설명
LicenseManager 클래스에서는 CurrentContext 및 UsageMode와 같은 static 속성을 제공합니다. 이 클래스는 또한 CreateWithContext, IsValid 및 Validate와 같은 static 메서드도 제공합니다.
라이센스를 부여할 구성 요소를 만들 때는 다음 작업을 수행해야 합니다.
해당 구성 요소를 LicenseProviderAttribute로 표시하여 LicenseProvider를 지정합니다.
해당 구성 요소의 생성자에서 Validate 또는 IsValid 메서드를 호출합니다. Validate 메서드는 유효한 라이센스가 없는 인스턴스를 만들려고 할 때 LicenseException을 throw하며, IsValid 메서드는 예외를 throw하지 않습니다.
해당 구성 요소가 삭제되거나 종료되면 부여된 모든 라이센스에 대해 Dispose를 호출합니다.
라이센스에 대한 자세한 내용은 방법: 구성 요소 및 컨트롤 라이센스를 참조하십시오.
참고
이 클래스에 적용되는 HostProtectionAttribute 특성의 Resources 속성 값은 ExternalProcessMgmt입니다. HostProtectionAttribute는 대개 아이콘을 두 번 클릭하거나, 명령을 입력하거나, 브라우저에서 URL을 입력하여 시작되는 데스크톱 응용 프로그램에 영향을 미치지 않습니다. 자세한 내용은 HostProtectionAttribute 클래스나 SQL Server 프로그래밍 및 호스트 보호 특성을 참조하십시오.
예제
다음 코드 예제에서는 Validate 메서드를 사용하여 라이센스 컨트롤을 만듭니다. 이 코드에서는 LicFileLicenseProvider 클래스에서 구현되는 LicenseProvider를 사용합니다.
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.Object
System.ComponentModel.LicenseManager
스레드로부터의 안전성
이 형식의 모든 public static(Visual Basic의 경우 Shared) 멤버는 스레드로부터 안전합니다. 인터페이스 멤버는 스레드로부터 안전하지 않습니다.
플랫폼
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에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.
버전 정보
.NET Framework
2.0, 1.1, 1.0에서 지원
참고 항목
참조
LicenseManager 멤버
System.ComponentModel 네임스페이스
License 클래스
LicenseContext 클래스
LicenseException 클래스
LicenseProvider
LicenseProviderAttribute
LicFileLicenseProvider
LicenseUsageMode