Name
LicenseManager
Synopsis
This class offers a set of static utility functions to support the licensing of components.
You can retrieve the CurrentContext
and the
UsageMode
(to determine whether this is a runtime
or design-time context). You can lock and unlock the context for a
particular object, effectively disabling the ability to get license
information for that object, using the LockContext( )
and UnlockContext()
methods.
To determine whether a particular object is licensed, you can use the
IsLicensed()
method. IsValid( )
and Validate()
determine whether a
valid license for an object can be granted. These methods use the
LicenseProvider
for the class to obtain a
validated license.
Typically, a licensable class is adorned with the
LicenseProviderAttribute
which indicates the type
of LicenseProvider
to use. It then makes a call to
Validate()
in its constructor, to ensure that a
suitable license is present for the current context.
public sealed class LicenseManager { // Public Static Properties public static LicenseContext CurrentContext{set; get; } public static LicenseUsageMode UsageMode{get; } // Public Static Methods public static object CreateWithContext(Type type, LicenseContext creationContext); public static object CreateWithContext(Type type, LicenseContext creationContext, object[] args); public static bool IsLicensed(Type type); public static bool IsValid(Type type); public static bool IsValid(Type type, object instance, out License license); public static void LockContext ...
Get .NET Windows Forms in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.