Ejemplo n.º 1
0
        private void FinishTyping(int star)
        {
            timer1.Stop();
            SoundPlayer spwinner = new SoundPlayer(@"sound\winner.wav");

            spwinner.Play();

            Frm_Rating rating;

            if (canRemake == true)
            {
                rating = new Frm_Rating(star, objectmodel, timeLeft, PositionKey);
            }
            else
            {
                rating = new Frm_Rating(star);
            }

            rating.ShowDialog(this);

            /*if (BUS.BUS_Typing.SaveDataPause(objectmodel, timeLeft, PositionKey, star) == true)
             * {
             *  MessageBox.Show("Save successful");
             *  this.Close();
             * }
             * else
             * {
             *  MessageBox.Show("Save Fail");
             * }*/

            this.Close();
        }
Ejemplo n.º 2
0
        private void Frm_Typing_Load(object sender, EventArgs e)
        {
            // Start the BackgroundWorker.
            backgroundWorker1.RunWorkerAsync();

            //finished = false;
            aTimer.Tick    += ATimer_Tick;
            aTimer.Interval = 3000;
            // danh cho check van ban
            //richTextBox1.Select(0,1);
            //richTextBox1.SelectionColor = Color.Green;
            //richTextBox1.Select(1, 3);
            //richTextBox1.SelectionColor = Color.Red;
            //RandomString();

            if (finished == true && PositionKey != 0)
            {
                PositionKey--;
            }

            int iAscii = RTB_String.Text[PositionKey];

            RTB_String.Select(0, PositionKey);
            RTB_String.SelectionColor = Color.Green;
            RTB_String.SelectionFont  = new System.Drawing.Font("Microsoft Sans Serif", 14.5F, System.Drawing.FontStyle.Underline);

            BUS_Typing.StopFocus(this);
            Control ctn = FindControlByTag(pn_Keys, iAscii); //.Controls[name];

            if (ctn != null)
            {
                HighLight((Button)ctn);
                HighLightShift(RTB_String.Text[PositionKey]);
            }
            if (PositionKey < RTB_String.Text.Length)
            {
                SetFingerVisible(RTB_String.Text[PositionKey].ToString().ToLower());
            }
            this.KeyPreview = true;

            if (finished == true)
            {
                Frm_Rating rating;

                if (canRemake == true)
                {
                    rating = new Frm_Rating(objectmodel.Star, objectmodel, timeLeft, PositionKey);
                }
                else
                {
                    rating = new Frm_Rating(objectmodel.Star);
                }

                this.Show();
                rating.ShowDialog(this);
                this.Close();
            }
        }
Ejemplo n.º 3
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            SoundPlayer spwinner = new SoundPlayer(@"sound\winner.wav");

            if (v == 0)
            {
                if (timeLeft != 0)
                {
                    timeLeft--;
                    lbTimer.Text = TimeSpan.FromSeconds(timeLeft).ToString(@"mm\:ss");

                    picwatch.Image = null;
                    if (dongho == 0)
                    {
                        picwatch.Image = Image.FromFile("xoaytrai.png");
                        dongho         = 1;
                    }
                    else
                    {
                        picwatch.Image = Image.FromFile("xoayphai.png");
                        dongho         = 0;
                    }
                }
                else
                {
                    timer1.Stop();
                    spwinner.Play();

                    Frm_Rating rating = new Frm_Rating(1);
                    rating.ShowDialog(this);

                    this.Close();
                }
            }
            else if (v == 1)
            {
                timer1.Stop();

                if (timeLeft < time * 0.3)
                {
                    spwinner.Play();

                    Frm_Rating rating = new Frm_Rating(1);
                    rating.ShowDialog(this);
                }

                else if (timeLeft >= time * 0.3 && timeLeft < time * 0.5)
                {
                    spwinner.Play();

                    Frm_Rating rating = new Frm_Rating(2);
                    rating.ShowDialog(this);
                }

                else if (timeLeft >= time * 0.5 && timeLeft < time * 0.7)
                {
                    spwinner.Play();

                    Frm_Rating rating = new Frm_Rating(3);
                    rating.ShowDialog(this);
                }

                else if (timeLeft >= time * 0.7 && timeLeft < time * 0.9)
                {
                    spwinner.Play();

                    Frm_Rating rating = new Frm_Rating(4);
                    rating.ShowDialog(this);
                }

                else if (timeLeft > time * 0.9)
                {
                    spwinner.Play();

                    Frm_Rating rating = new Frm_Rating(5);
                    rating.ShowDialog(this);
                }

                this.Close();
            }
        }