Ejemplo n.º 1
0
        private void Text_Enter(object sender, View.KeyEventArgs e)
        {
            e.Handled = false;
            if (e.Event.Action == KeyEventActions.Down && e.KeyCode == Keycode.Enter)
            {
                t = t + 1;
                WordIgbo wd = null;
                int      n  = int.Parse(hidden.Text);
                if (((n >= 0) && (n <= 9)) || ((n >= 20) && (n <= 29)))
                {
                    ToBeIgbo tbi = new ToBeIgbo();
                    if ((n >= 0) && (n <= 9))
                    {
                        tbi.propValue = n;
                    }
                    ;
                    if ((n >= 20) && (n <= 29))
                    {
                        tbi.propValue = n - 20;
                    }
                    wd = tbi;
                }
                if (((n >= 10) && (n <= 19)) || ((n >= 30) && (n <= 39)))
                {
                    ToHaveIgbo thi = new ToHaveIgbo();
                    if ((n >= 10) && (n <= 19))
                    {
                        thi.propValue = n - 10;
                    }
                    if ((n >= 30) && (n <= 39))
                    {
                        thi.propValue = n - 30;
                    }
                    wd = thi;
                }
                if (wd.checkIton(name.Text.ToUpper()) == true)
                {
                    s = s + 1;
                    //if (msgBoxLabel.BackColor == Color.Gold)
                    //{ msgBoxLabel.BackColor = Color.Green; }
                    //else
                    //{ msgBoxLabel.BackColor = Color.Gold; }
                    message.Text = "Correct";
                    //Timer ti = new Timer();
                    //ti.Tick += blinkTextbox;
                    //ti.Interval = 450;
                    //ti.Enabled = true;
                }
                if (wd.checkIton(name.Text.ToUpper()) == false)
                {
                    message.Text = "Incorrect answer below";
                    Task.Delay(1000).Wait();
                }
                score.Text = s.ToString();
                total.Text = t.ToString();

                Random rnd   = new Random();
                int    myVal = rnd.Next(0, 10);
                if ((n >= 0) && (n <= 9))
                {
                    ToBeIgbo tbi = new ToBeIgbo();
                    tbi.propValue = myVal;
                    wd            = tbi;
                    hidden.Text   = myVal.ToString();
                }
                if ((n >= 10) && (n <= 19))
                {
                    ToHaveIgbo thi = new ToHaveIgbo();
                    thi.propValue = myVal;
                    wd            = thi;
                    hidden.Text   = (myVal + 10).ToString();
                }
                if ((n >= 20) && (n <= 39))
                {
                    Random rnd2   = new Random();
                    int    myVal2 = rnd.Next(0, 2);
                    if (myVal2 == 0)
                    {
                        ToBeIgbo tbi = new ToBeIgbo();
                        tbi.propValue = myVal;
                        wd            = tbi;
                        hidden.Text   = (myVal + 20).ToString();
                    }
                    if (myVal2 == 1)
                    {
                        ToHaveIgbo thi = new ToHaveIgbo();
                        thi.propValue = myVal;
                        wd            = thi;
                        hidden.Text   = (myVal + 30).ToString();
                    }
                }
                wd.play();
                name.Text = "";

                e.Handled = true;
            }
        }
Ejemplo n.º 2
0
        private void Text_Enter(object sender, View.KeyEventArgs e)
        {
            e.Handled = false;
            if (e.Event.Action == KeyEventActions.Down && e.KeyCode == Keycode.Enter)
            {
                WordIgbo wd = null;
                int      n  = int.Parse(hidden.Text);
                if (((n >= 0) && (n <= 9)) || ((n >= 20) && (n <= 29)))
                {
                    ToBeIgbo tbi = new ToBeIgbo();
                    if ((n >= 0) && (n <= 9))
                    {
                        tbi.propValue = n;
                    }
                    ;
                    if ((n >= 20) && (n <= 29))
                    {
                        tbi.propValue = n - 20;
                    }
                    wd = tbi;
                }
                if (((n >= 10) && (n <= 19)) || ((n >= 30) && (n <= 39)))
                {
                    ToHaveIgbo thi = new ToHaveIgbo();
                    if ((n >= 10) && (n <= 19))
                    {
                        thi.propValue = n - 10;
                    }
                    if ((n >= 30) && (n <= 39))
                    {
                        thi.propValue = n - 30;
                    }
                    wd = thi;
                }
                if (wd.checkIton(name.Text.ToUpper()) == true)
                {
                    hiddenOldValueLabel = "correct";
                    message2.Text       = "";
                    message3.Text       = "";
                    //if (message.HighlightColor == Color.Gold)
                    //{ message.SetBackgroundColor(Color.Green); }
                    //else
                    //{ message.SetBackgroundColor(Color.Gold); }
                    message.Text = "Correct";
                    //Timer ti = new Timer();
                    //ti.Tick += blinkTextbox;
                    //ti.Interval = 450;
                    //ti.Enabled = true;
                }
                if (wd.checkIton(name.Text.ToUpper()) == false)
                {
                    hiddenOldValueLabel = "incorrect";
                    message.Text        = "Incorrect: Click answer below / Click reponse ci-bas";
                    message2.Text       = wd.propStemEnglish[wd.propValue];
                    message3.Text       = wd.propStemFrench[wd.propValue];
                    hiddenOld.Text      = n.ToString();
                }

                Random rnd   = new Random();
                int    myVal = rnd.Next(0, 10);
                if ((n >= 0) && (n <= 9))
                {
                    ToBeIgbo tbi = new ToBeIgbo();
                    tbi.propValue = myVal;
                    wd            = tbi;
                    hidden.Text   = myVal.ToString();
                }
                if ((n >= 10) && (n <= 19))
                {
                    ToHaveIgbo thi = new ToHaveIgbo();
                    thi.propValue = myVal;
                    wd            = thi;
                    hidden.Text   = (myVal + 10).ToString();
                }
                if ((n >= 20) && (n <= 39))
                {
                    Random rnd2   = new Random();
                    int    myVal2 = rnd.Next(0, 2);
                    if (myVal2 == 0)
                    {
                        ToBeIgbo tbi = new ToBeIgbo();
                        tbi.propValue = myVal;
                        wd            = tbi;
                        hidden.Text   = (myVal + 20).ToString();
                    }
                    if (myVal2 == 1)
                    {
                        ToHaveIgbo thi = new ToHaveIgbo();
                        thi.propValue = myVal;
                        wd            = thi;
                        hidden.Text   = (myVal + 30).ToString();
                    }
                }
                if (hiddenOldValueLabel == "correct")
                {
                    wd.play();
                }

                name.Text = "";

                e.Handled = true;
            }
        }