Ejemplo n.º 1
0
        private void OK_Button_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;
            DateTime validity = DateTime.Now;
            string   Key      = cn.Encrypt("KP" + DateTime.Now.Year);

            if (Key == txtKey.Text)
            {
                Properties.Settings.Default.Registered = true;
                Properties.Settings.Default.Validity   = validity;
                Properties.Settings.Default.Save();
                if (Properties.Settings.Default.Validity.Add(new TimeSpan(360, 0, 0, 0, 0)) > DateTime.Now)
                {
                    MetroSetForm main = new Login();
                    main.Show();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("Re - active your software. (Contact To Developer)");
                }
            }
            else
            {
                Properties.Settings.Default.Registered = false;
                Properties.Settings.Default.Save();
                MessageBox.Show("Invalid Key", "Activation Failed.", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            //txtKey.Text = Key;
        }