예제 #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (checkBox1.Checked)
     {
         if (textBox1.Text != null && textBox2.Text != null)
         {
             if (MethodsClass.LicenseCheck(MethodsClass.CreateKey(textBox1.Text), textBox2.Text))
             {
                 Regedit.Write(textBox1.Text, textBox2.Text);
                 MessageBox.Show("Thank you for your purchase.");
                 Application.Restart();
             }
             else
             {
                 MessageBox.Show("The license is not valid, check it and if it still doesn't work, contact the developer.");
             }
         }
         else
         {
             MessageBox.Show("Be sure to fill in all the fields.");
         }
     }
     else
     {
         MessageBox.Show("You must accept EULA first.");
     }
 }
예제 #2
0
        private void ParentForm_Load(object sender, EventArgs e)
        {
            this.Text = this.Text + " v" + Assembly.GetExecutingAssembly().GetName().Version.ToString();



            DatabaseClass.CreateDB();
            DatabaseClass.CreateTable();
            string[] LicenseKey = new string[2];
            LicenseKey = Regedit.Read();

            DatabaseClass.DeleteOlderThen(Settings.Default.DeletePeriod.ToString());

            if (LicenseKey == null)
            {
                menuStrip1.Enabled = false;
                Form License = new License();
                License.MdiParent = this;
                License.Show();
            }
            else if (!MethodsClass.LicenseCheck(MethodsClass.CreateKey(LicenseKey[0]), LicenseKey[1]))
            {
                menuStrip1.Enabled = false;
                Form License = new License();
                License.MdiParent = this;
                License.Show();
            }
            else if (!DatabaseClass.LocationTableCheck())
            {
                menuStrip1.Enabled = false;
                if (!DatabaseClass.ProductsTableCheck())
                {
                    if (MessageBox.Show(
                            "Do you have a database created and backed up with this program that you want to add to the system? \nIf you choose a wrong file, you may need to uninstall and reinstall the program.", "Warning!", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk
                            ) == DialogResult.Yes)
                    {
                        Form ImportDatabaseFile = new ImportDatabaseFile();
                        ImportDatabaseFile.ShowDialog();
                    }
                    else
                    {
                        Form AddLocation = new AddLocation();
                        AddLocation.ShowDialog();
                    }
                }
                else
                {
                    Form AddLocation = new AddLocation();
                    AddLocation.ShowDialog();
                }
            }
            else
            {
                Form HomeForm = new Home();
                HomeForm.MdiParent = this;
                HomeForm.Show();
            }
        }