protected virtual void OnLicenceTextChanged(object sender, EventArgs e)
{
bool valid = false;
string error = string.Empty;
EncryptedLicense license = GetLicenseProvider().ValidateLicenseKey(_keyText.Text);
if (license != null)
{
int thisVersion = 400;
switch (LicenseInstallForm.GetProductCode(license.ProductInfo))
{
case "S":
int version = int.Parse(LicenseInstallForm.GetVersionCode(license.ProductInfo));
if (version == thisVersion)
{
valid = true;
error = "Key Validated. Press OK to continue.";
}
else
error = "Invalid Version Number. This serial key is valid for version '" + version + "' of Krypton but you " +
"need a version '" + thisVersion.ToString() + "' serial key. You would have been emailed a matching key " +
"when you purchased or were sent a release notification. Please find and enter that matching serial key.";
break;
default:
error = "Invalid key. Please enter the key that was emailed with the purchase of the software.";
break;
}
}
else
error = "Invalid key. Check you have entered all serial key characters.";
kryptonButtonIgnore.Enabled = !valid;
kryptonButtonOK.Enabled = valid;
_msgError.ForeColor = (valid ? Color.Green : Color.Red);
if (string.IsNullOrEmpty(_keyText.Text))
_msgError.Text = string.Empty;
else
_msgError.Text = error;
}