Exemplo n.º 1
0
        private void textBox1_LostFocus(object sender, EventArgs e)
        {
            int value;

            try
            {
                if (textBox1.Text.Trim() == "")
                {
                    return;
                }
                value = int.Parse(textBox1.Text);
                if (value < 0 || value > 15)
                {
                    var MessageBox = new frmConfirm(1);
                    textBox1.Focus();
                    if (iii == 0)
                    {
                        iii++;
                        MessageBox.ShowDialog();
                    }
                    //MessageBox.Show("Please enter a number between 0 and 15.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
                Optimizer.Decimal = value;
                WriteSettings();
            }
            catch
            {
                //MessageBox.Show("Please enter a valid number.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                //textBox1.Focus();
                var MessageBox = new frmConfirm(2);
                textBox1.Focus();
                if (iii == 0)
                {
                    iii++;
                    MessageBox.ShowDialog();
                }
            }
        }
Exemplo n.º 2
0
 private void button6_Click(object sender, EventArgs e)
 {
     if (t1 != null && t1.IsAlive == true)
     {
         //e.Cancel = true;
         var          fm = new frmConfirm();
         DialogResult ok = fm.ShowDialog();
         if (ok == DialogResult.Cancel)
         {
             return;
         }
         t1.Abort();
         timerclose.Enabled = true;
         return;
         //DialogResult ok = MessageBox.Show("Optimization is running, quit?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         //if (ok == DialogResult.No) return;
         //t1.Abort();
         //timerclose.Enabled = true;
         //return;
     }
     //e.Cancel = false;
     timerclose.Enabled = true;
 }