Ejemplo n.º 1
0
        private void btnStop_Click(object sender, EventArgs e)
        {
            player.Ctlcontrols.stop();
            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;

            lblStatus.Text = "Ожидание";

            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);

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

            PrepareTimer.Stop();
            goTimer.Stop();
            pauseTimer.Stop();
        }
Ejemplo n.º 2
0
        private void PrepareTimer_Tick(object sender, EventArgs e)
        {
            if (prepareTime >= 1)
            {
                tk = --prepareTime;
                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
            {
                PrepareTimer.Stop();    // stops the timer
                PrepareTimer.Dispose(); //releases teh resources used by the timer
                prepareTime = Convert.ToInt32(numStart.Value);

                lblStatus.Text   = "Music time";
                lbRoundsNum.Text = Convert.ToString(rounds - 1);

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

                int item = 0;
                for (int i = 0; i < playlist.count; i++)
                {
                    string temp = songList.Text;
                    temp = temp.TrimStart(' ');
                    temp = temp.TrimEnd(' ');
                    if (playlist.Item[i].name.Equals(temp))
                    {
                        item = i;
                        break;
                    }
                }
                player.Ctlcontrols.playItem(playlist.Item[item]);
            }
        }