Ejemplo n.º 1
0
 private void takeUnBreakableBreakToolStripMenuItem_Click(object sender, EventArgs e)
 {
     timerStopButton_Click(sender, e);
     breakForm = new BreakForm(this, "forced");
     breakForm.Show();
     this.Hide();
 }
Ejemplo n.º 2
0
        private void timer_Tick(object sender, EventArgs e)
        {
            if ((hours == 0) && (minutes == 0) && (seconds == 0))
            {
                timer.Enabled            = false;
                timerStopButton.Enabled  = false;
                timerPauseButton.Enabled = false;
                timerStartButton.Enabled = true;
                resetTimer();
                if (Properties.Settings.Default.playSound)
                {
                    try
                    {
                        player = new SoundPlayer(@"BreakStart.wav");
                        player.Play();
                    }

                    catch { }
                }

                breakForm = new BreakForm(this);
                breakForm.Show();
                this.Hide();
            }
            else
            {
                if (hours == 0 && minutes == 0 && seconds == 30)
                {
                    if (Properties.Settings.Default.playSound)
                    {
                        try
                        {
                            player = new SoundPlayer(@"BreakApproach.wav");
                            player.Play();
                        }
                        catch { }
                    }
                    notifyIcon.BalloonTipTitle = "BreakTimer";
                    notifyIcon.BalloonTipText  = "Still 30 seconds to the break, try to finish what are you doing.";
                    notifyIcon.ShowBalloonTip(5000);
                }
                if (seconds < 1)
                {
                    seconds  = 59;
                    minutes -= 1;
                }
                if (minutes < 1)
                {
                    if (hours == 0)
                    {
                        hours = 0;
                    }
                    else
                    {
                        hours  -= 1;
                        minutes = 59;
                    }
                }
                hours_label.Text   = hours.ToString().PadLeft(2, '0');
                minutes_label.Text = minutes.ToString().PadLeft(2, '0');
                seconds_label.Text = seconds.ToString().PadLeft(2, '0');
                seconds           -= 1;
            }
        }