Exemplo n.º 1
0
        public static bool Check()
        {
            if (DateTime.Now - LastLicenseCheck < LicenseCheckInterval)
            {
                return(true);
            }

            LicenseCheck.License license = LicenseCheck.License.FromRegistry(LicenseRegistryKey, LicensedAppName);
            if (license.Status == LicenseCheck.License.LicenseStatus.Valid)
            {
                LastLicenseCheck = DateTime.Now;
                return(true);
            }

            using (LicenseCheck.RequestLicenseForm form = new LicenseCheck.RequestLicenseForm())
            {
                form.ActivationCode = LicenseCheck.License.FormatActivationCode(LicenseCheck.License.GetActivationCode(LicensedAppName));
                if (Autodesk.AutoCAD.ApplicationServices.Application.ShowModalDialog(null, form, false) != System.Windows.Forms.DialogResult.OK)
                {
                    return(false);
                }

                license = LicenseCheck.License.FromFile(form.LicenseFile, LicensedAppName);
                if (license.Status != LicenseCheck.License.LicenseStatus.Valid)
                {
                    return(false);
                }

                license.SaveToRegistry(LicenseRegistryKey);

                LastLicenseCheck = DateTime.Now;
                return(true);
            }
        }
Exemplo n.º 2
0
        public static bool Check()
        {
            if (DateTime.Now - LastLicenseCheck < LicenseCheckInterval)
            {
                return(true);
            }

            LicenseCheck.License license = LicenseCheck.License.FromRegistry(LicenseRegistryKey, LicensedAppName);
            if (license.Status == LicenseCheck.License.LicenseStatus.Valid)
            {
                license.SaveToRegistry(LicenseRegistryKey);

                LastLicenseCheck = DateTime.Now;
                return(true);
            }
            else
            {
                return(Request());
            }
        }
Exemplo n.º 3
0
        public static void LicenseInformation()
        {
            LicenseCheck.License license = LicenseCheck.License.FromRegistry(LicenseRegistryKey, LicensedAppName);

            Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage(license.LicenseInfo);
        }