Пример #1
0
 private void btnRegister_Click(object sender, EventArgs e)
 {
     // validate key entered
     LicenceKeyValidator.Validate(txtKey.Text);
     if (Globals.registered)
     {
         registrationKey = txtKey.Text;
         using (TextWriter writer = new StreamWriter(Globals.productKeyFile, false)) {
             writer.Write(registrationKey);
         }
         MessageBox.Show("This software is successfully registered.", "Registered", MessageBoxButtons.OK, MessageBoxIcon.Information);
         this.Close();
     }
     else
     {
         MessageBox.Show("Invalid key! Please enter the valid key", "Validation failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Пример #2
0
        // this is not form load event handler
        private void LoadApplication()
        {
            // Set toolbar images
            btnNew.Image  = sysilsSmall.Icon(sysilsSmall.IconIndex(Globals.imagesFolder + Globals.imgNew, true)).ToBitmap();
            btnOpen.Image = sysilsSmall.Icon(sysilsSmall.IconIndex(Globals.imagesFolder + Globals.imgOpen, true)).ToBitmap();
            btnSave.Image = sysilsSmall.Icon(sysilsSmall.IconIndex(Globals.imagesFolder + Globals.imgSave, true)).ToBitmap();
            btnRun.Image  = sysilsSmall.Icon(sysilsSmall.IconIndex(Globals.imagesFolder + Globals.imgNvnInstallerIcon, true)).ToBitmap();
            btnHelp.Image = sysilsSmall.Icon(sysilsSmall.IconIndex(Globals.imagesFolder + Globals.imgHelp, true)).ToBitmap();

            // load each controls
            foreach (Control control in ControlsManager.Controls.Values)
            {
                if (control is INvnControl)
                {
                    ((INvnControl)control).InitializeLoad();
                    ((INvnControl)control).Load();
                }
            }
            // validate license key
            LicenceKeyValidator.Validate();
        }