private void ok_btn_Click(object sender, EventArgs e)
        {
            KeyManager km         = new KeyManager(productid_lbl.Text);
            string     productKey = productkey_txt.Text;

            //Check valid
            if (km.ValidKey(ref productKey))
            {
                KeyValuesClass kv = new KeyValuesClass();
                //Decrypt license key
                if (km.DisassembleKey(productKey, ref kv))
                {
                    LicenseInfo lic = new LicenseInfo();
                    lic.ProductKey = productKey;
                    lic.FullName   = "ABCD BANK";

                    //Save license key to file
                    km.SaveSuretyFile(string.Format(@"{0}\active.lic", Application.StartupPath), lic);
                    MessageBox.Show("You have been successfully registered.", "ABCD BANK", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Dispose();
                    Login_form lgf = new Login_form();
                    lgf.Show();
                }
            }
            else
            {
                MessageBox.Show("Your product key is invalid.", "ABCD BANK", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Пример #2
0
        private void Detail_View_form_FormClosing(object sender, FormClosingEventArgs e)
        {
            DialogResult result = MessageBox.Show("Are you want to Exit..", "ABCD BANK", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                this.Dispose();
                Login_form lg = new Login_form();
                lg.Show();
            }
            else if (result == DialogResult.No)
            {
                e.Cancel = true;
            }
            else if (result == DialogResult.Cancel)
            {
                e.Cancel = true;
            }
        }