Example #1
0
        /// <summary>Determines whether a license can be granted for the instance of the specified type.</summary>
        /// <returns>A valid <see cref="T:System.ComponentModel.License" />.</returns>
        /// <param name="type">A <see cref="T:System.Type" /> that represents the type of object that requests the license. </param>
        /// <param name="instance">An <see cref="T:System.Object" /> of the specified type or a type derived from the specified type. </param>
        /// <exception cref="T:System.ComponentModel.LicenseException">The type is licensed, but a <see cref="T:System.ComponentModel.License" /> cannot be granted. </exception>
        public static License Validate(Type type, object instance)
        {
            License result = null;

            if (!LicenseManager.privateGetLicense(type, instance, true, out result))
            {
                throw new LicenseException(type, instance);
            }
            return(result);
        }
Example #2
0
        /// <summary>Determines whether a license can be granted for the specified type.</summary>
        /// <param name="type">A <see cref="T:System.Type" /> that represents the type of object that requests the license. </param>
        /// <exception cref="T:System.ComponentModel.LicenseException">A <see cref="T:System.ComponentModel.License" /> cannot be granted. </exception>
        public static void Validate(Type type)
        {
            License license = null;

            if (!LicenseManager.privateGetLicense(type, null, true, out license))
            {
                throw new LicenseException(type, null);
            }
            if (license != null)
            {
                license.Dispose();
            }
        }
Example #3
0
        /// <summary>Determines whether a valid license can be granted for the specified type.</summary>
        /// <returns>true if a valid license can be granted; otherwise, false.</returns>
        /// <param name="type">A <see cref="T:System.Type" /> that represents the type of object that requests the <see cref="T:System.ComponentModel.License" />. </param>
        public static bool IsValid(Type type)
        {
            License license = null;

            if (!LicenseManager.privateGetLicense(type, null, false, out license))
            {
                return(false);
            }
            if (license != null)
            {
                license.Dispose();
            }
            return(true);
        }
Example #4
0
 /// <summary>Determines whether a valid license can be granted for the specified instance of the type. This method creates a valid <see cref="T:System.ComponentModel.License" />.</summary>
 /// <returns>true if a valid <see cref="T:System.ComponentModel.License" /> can be granted; otherwise, false.</returns>
 /// <param name="type">A <see cref="T:System.Type" /> that represents the type of object that requests the license. </param>
 /// <param name="instance">An object of the specified type or a type derived from the specified type. </param>
 /// <param name="license">A <see cref="T:System.ComponentModel.License" /> that is a valid license, or null if a valid license cannot be granted. </param>
 public static bool IsValid(Type type, object instance, out License license)
 {
     return(LicenseManager.privateGetLicense(type, null, false, out license));
 }