Esempio n. 1
0
        private void button40_Click(object sender, EventArgs e)
        {
            if (selected.Count < 1)
            {
                MessageBox.Show("Check few notes to play (Checkboxes)", "notice");
                return;
            }
            answered = false;
            total++;
            label5.Text = total.ToString();

            this.label6.Text = "";

            Random rnd = new Random();

            current = selected.ElementAt(rnd.Next(selected.Count));


            play(current.Tag.ToString());


            NoteAnswer na = new NoteAnswer(cntList++ + " " + "Note played");

            na.note = current.Tag.ToString();

            this.listBox1.Items.Add(na);
            this.listBox1.TopIndex = this.listBox1.Items.Count - 1;

            if (freshStart)
            {
                freshStart = false;

                stopWatch = Stopwatch.StartNew();
            }
        }
Esempio n. 2
0
        private void list_double_clicked(object sender, MouseEventArgs e)
        {
            int index = this.listBox1.IndexFromPoint(e.Location);

            if (index != System.Windows.Forms.ListBox.NoMatches)
            {
                NoteAnswer na = (NoteAnswer)this.listBox1.Items[index];

                //  pl.Stop();

                //  pl.SoundLocation = path + na.note + ".wav";

                //   pl.Play();
                play(na.note);
            }
        }
Esempio n. 3
0
        // String path = @"notes2-4.01\";
        //  String path = @"res\";
        private void button_pressed(Object o, MouseEventArgs e)
        {
            Button b = (Button)o;

            b.BackColor = SystemColors.ControlDark;


            if (checkBox37.Checked == false)
            {
                // pl.Stop();

                //   pl.SoundLocation = path + b.Tag + ".wav";

                // pl.Play();
                play(b.Tag.ToString());
            }
            if (current == null)
            {
                return;
            }

            if (current.Tag.ToString() == b.Tag.ToString())
            {
                if (answered == false)
                {
                    label6.Text = "Good Job!";
                    hits++;
                    label4.Text = hits.ToString();
                    streak++;
                    this.progressBar1.Value = streak * 10;


                    NoteAnswer na = new NoteAnswer(cntList++ + " " + "Answer " + b.Tag.ToString() + " correct");
                    na.note = b.Tag.ToString();

                    this.listBox1.Items.Add(na);
                    this.listBox1.TopIndex = this.listBox1.Items.Count - 1;

                    if (streak == 20)
                    {
                        if (MessageBox.Show("Score is " + hits + " of " + total + "\n\n 'OK' to copy to clipboard", "Congratz!", MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.OK)
                        {
                            stopWatch.Stop();
                            saveToClipboard();
                        }
                    }
                }
                else
                {
                    label6.Text = "Correct!      " + b.Tag.ToString();
                }
            }
            else
            {
                label6.Text = "Miss!";
                if (answered == false)
                {
                    NoteAnswer na = new NoteAnswer(cntList++ + " " + "Answer " + b.Tag.ToString() + " missed");
                    na.note = b.Tag.ToString();


                    this.listBox1.Items.Add(na);
                    this.listBox1.TopIndex = this.listBox1.Items.Count - 1;
                    streak -= 5;
                    if (streak < 0)
                    {
                        streak = 0;
                    }


                    aTimer                     = new System.Timers.Timer(30);
                    aTimer.Elapsed            += new ElapsedEventHandler(OnTimedEvent);
                    aTimer.SynchronizingObject = this;

                    aTimer.Start();
                }
            }

            answered = true;
        }