Exemplo n.º 1
0
        private void initialize(int pMin, int pMax, control ct0)
        {
            this.vMin         = pMin;
            this.vMax         = pMax;
            this.ct0          = ct0;
            this.t0           = new System.Timers.Timer(this.ct0.globals.speed);
            this.t0.AutoReset = true;
            this.t0.Elapsed  += (sender, e) => { this.ejecuta(); };

            this.rGen = new Random();
            this.start();
        }
        private void start()
        {
            if (this.txt_minimo.Text.Trim() != String.Empty && this.txt_maximo.Text.Trim() != String.Empty)
            {
                try
                {
                    this.vMin = int.Parse(this.txt_minimo.Text);
                    this.vMax = int.Parse(this.txt_maximo.Text);

                    if (this.vMin > this.vMax)
                    {
                        msg.danger("Valor menor debe ser menor a mayor y viceversa.");
                        this.txt_minimo.Focus();
                        return;
                    }

                    if (this.txtopd.Text != string.Empty)
                    {
                        this.vX = int.Parse(this.txtopd.Text);

                        if (!(this.vX > this.vMin && this.vX < this.vMax))
                        {
                            msg.danger("El valor especifico debe de estar entre margenes...");
                            this.txtopd.Focus();
                            this.controlx = true;
                            return;
                        }
                    }
                }
                catch (System.FormatException sfe)
                {
                    msg.danger("Formato incorrecto!");
                    this.txt_minimo.Focus();
                    return;
                }
            }
            else
            {
                msg.danger("Complete valores...");
                this.txt_minimo.Focus();
                return;
            }

            this.c1 = new control(this);
            this.Hide();
            this.c1.Show();
        }
Exemplo n.º 3
0
 public logica(int pMin, int pMax, int pX, control ct0)
 {
     this.initialize(pMin, pMax, ct0);
     this.vX = pX;
 }