Exemple #1
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            prepareTime       = Convert.ToInt32(numStart.Value) * 60;
            musicTime         = Convert.ToInt32(numMusic.Value) * 60;
            pauseTime         = Convert.ToInt32(numPause.Value) * 60;
            rounds            = Convert.ToInt32(numRounds.Value);
            cicles            = Convert.ToInt32(numCicles.Value);
            btnStart.Enabled  = false;
            btnFolder.Enabled = false;
            btnStop.Enabled   = true;
            songList.Enabled  = false;

            numStart.Enabled  = false;
            numMusic.Enabled  = false;
            numPause.Enabled  = false;
            numRounds.Enabled = false;
            numCicles.Enabled = false;

            lblStatus.Text   = "Подготовка";
            lbRoundsNum.Text = Convert.ToString(rounds);
            lbCiclesNum.Text = Convert.ToString(cicles - 1);

            PrepareTimer.Start();
        }
Exemple #2
0
        private void pauseTimer_Tick(object sender, EventArgs e)
        {
            if (pauseTime >= 1)
            {
                tk = --pauseTime;
                TimeSpan span = TimeSpan.FromSeconds(tk);
                string   label;
                if (tk < 3600)
                {
                    label = span.ToString(@"mm\:ss");
                }
                else
                {
                    label = span.ToString(@"hh\:mm\:ss");
                }
                lbTimer.Text = label.ToString();
            }
            else
            {
                pauseTimer.Stop();    // stops the timer
                pauseTimer.Dispose(); //releases teh resources used by the timer
                pauseTimer.Enabled = false;
                pauseTime          = Convert.ToInt32(numMusic.Value);

                rounds--;
                lbRoundsNum.Text = Convert.ToString(rounds - 1);
                prepareTime      = Convert.ToInt32(numStart.Value) * 60;
                musicTime        = Convert.ToInt32(numMusic.Value) * 60;
                pauseTime        = Convert.ToInt32(numPause.Value) * 60;
                if (rounds <= 0)
                {
                    --cicles;
                    rounds           = Convert.ToInt32(numRounds.Value);
                    lbCiclesNum.Text = Convert.ToString(cicles - 1);
                    player.Ctlcontrols.stop();
                    SoundPlayer fin = new SoundPlayer(Properties.Resources.GlsShutdn);
                    fin.PlaySync();
                    if (cicles <= 0)
                    {
                        fin.PlaySync();
                        btnFolder.Enabled = true;
                        btnStop.Enabled   = false;
                        btnStart.Enabled  = true;
                        songList.Enabled  = true;
                        numStart.Enabled  = true;
                        numMusic.Enabled  = true;
                        numPause.Enabled  = true;
                        numRounds.Enabled = true;
                        numCicles.Enabled = true;

                        lbCiclesNum.Text = "0";
                        lbRoundsNum.Text = "0";
                        lbTimer.Text     = "00:00";

                        lblStatus.Text = "Ожидание";
                    }
                    else
                    {
                        lblStatus.Text = "Подготовка";
                        Convert.ToInt32(numCicles.Value);
                        lbRoundsNum.Text = Convert.ToString(rounds - 1);
                        lbCiclesNum.Text = Convert.ToString(cicles);

                        PrepareTimer.Start();
                    }
                }
                else
                {
                    lblStatus.Text = "Music time";

                    goTimer.Start(); //starts the workout
                    goTimer.Enabled = true;

                    Random rnd  = new Random();
                    int    item = rnd.Next(0, playlist.count - 1);
                    player.Ctlcontrols.playItem(playlist.Item[item]);
                }
            }
        }