コード例 #1
0
        private void RegisterBtn_Click(object sender, EventArgs e)
        {
            strKey = this.licText.Text;
            switch (XEditNetLicenseValidator.ValidateLicense(strKey))
            {
            case LicenseState.Full:
                StoreKey();
                MessageBox.Show("Thank you for purchasing XEditNet", "Thank you");
                DialogResult = DialogResult.OK;
                this.Close();
                break;

            case LicenseState.Invalid:
                MessageBox.Show("Sorry, this is an invalid key", "Error");
                break;

            case LicenseState.None:
                MessageBox.Show("None");
                break;

            case LicenseState.Trial_Active:
                StoreKey();
                MessageBox.Show("This key is an active trial key and has been stored", "Thank you");
                DialogResult = DialogResult.OK;
                this.Close();
                break;

            case LicenseState.Trial_Expired:
                MessageBox.Show("Sorry, this is a trial key that has already expired", "Error");
                break;
            }
        }
コード例 #2
0
        public XEditNetLicence(string strSavedLicense)
        {
            /*
             * Constructor, creates and destroys the underlying real BaseLicense,
             * providing access to the 3 public Members, LicenseKey, Validity and ExpiryDate
             * */
            try
            {
                LicenseBase licReal = new LicenseBase(strSavedLicense.ToUpper());
                licenseKey = licReal.LicenseKey;
                validity   = XEditNetLicenseValidator.ValidateLicense(LicenseKey);
                if (licReal.LicenseObject.Type == LicenseType.LicenseTypes.Trial)
                {
                    expiryDate = licReal.ExpiryDate.LicenseDateTime;
                }

                licReal = null;
            }
            catch (InvalidLicenseException)
            {
                validity   = LicenseState.Invalid;
                expiryDate = DateTime.MinValue;
            }
        }