예제 #1
0
 private void Form3_Load(object sender, EventArgs e)
 {
     txtProductCode.Text = AppLicense.GetProductCode();
     txtActivation.Text  = AppConfig.GetLicense();
     if (AppLicense.IsValid("", "", txtActivation.Text))
     {
         DateTime dt = AppLicense.GetValidUntilDate("", "", txtActivation.Text);
         if (dt == DateTime.MinValue)
         {
             lblUntil.Text = "No License";
         }
         else
         {
             lblUntil.Text = "License Valid Until : " + dt.ToString("dd MMM yyyy hh:mm tt");
         }
     }
     else
     {
         lblUntil.Text = "No License";
     }
     txtProductCode_TextChanged(txtProductCode, EventArgs.Empty);
 }
예제 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (AppLicense.IsValid("", "", txtActivation.Text) == false)
            {
                MessageBox.Show("Invalid License Key");
                return;
            }

            DateTime dt2 = AppLicense.GetValidUntilDate("", "", AppConfig.GetLicense());
            DateTime dt  = AppLicense.GetValidUntilDate("", "", txtActivation.Text);

            if (dt > dt2)
            {
                MessageBox.Show("Thank you for activating");
                AppConfig.AddOrUpdateAppSettings("License", txtActivation.Text);
            }
            else
            {
                MessageBox.Show("Fail to apply old license");
            }
            Close();
        }