Exemplo n.º 1
0
        private async void timer_Tick(object sender, EventArgs e)
        {
            remainingTime = endDate - DateTime.UtcNow;
            int angle = (int)(360.0 * (remainingTime.TotalSeconds / totalTime.TotalSeconds));

            if (remainingTime > TimeSpan.FromSeconds(1))
            {
                cpsBar.Text  = remainingTime.ToString(@"mm\:ss");
                cpsBar.Value = angle;
                await Task.Delay(1000);

                cpsBar.AnimationSpeed = 0;
            }
            else
            {
                timer.Enabled = false;

                if (intervalType == IntervalType.Work)
                {
                    playSound(Pomodoro.WorkComplatedSoundIndex);
                    Pomodoro.ComplatedWorksCount++;
                }
                else
                {
                    playSound(Pomodoro.EndBreakSoundIndex);
                    Pomodoro.EndBreakCount++;
                    Pomodoro.TotalPomodoroCount++;
                }

                showValues();

                FilePomodoro.WriteToday();

                cpsBar.Text = done;
                changeIntervalType();
                changMediaType();
                setToolEnable(true);
                updateTheme();
                updateTodayDesign();
                cpsBar.Value     = 0;
                this.WindowState = this.WindowState;


                if (Pomodoro.AutoStart == true)
                {
                    PlayPause_Click(sender, e);
                }

                //Pomodoro.WorkTime += Pomodoro.WorkInterval;
                //Pomodoro.TotalWorkTime += Pomodoro.WorkInterval;
            }
        }
Exemplo n.º 2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            FilePomodoro.CheckFiles();

            //Pomodoro.ComplatedWorksCount = 0;
            //Pomodoro.EndBreakCount = 0;
            //Pomodoro.TotalPomodoroCount = 0;
            showValues();
            //Application.Exit();

            btnPlayPause.Click += new EventHandler(PlayPause_Click);
            panelPlayPause.Controls.Add(btnPlayPause);
            this.AcceptButton = btnPlayPause;

            getRes(new CultureInfo(CultureInfo));

            intervalType = IntervalType.Work;
            mediaType    = MediaType.Play;

            // Values clearing if current day is diffrent from last record
            if (!String.Equals(DateTime.Today.ToShortDateString(), Settings.Default.CurrentDate))
            {
                Pomodoro.ComplatedWorksCount = 0;
                Pomodoro.EndBreakCount       = 0;

                Settings.Default.CurrentDate = DateTime.Today.ToShortDateString();
                Settings.Default.Save();
            }
            else
            {
                if (Pomodoro.ComplatedWorksCount > Pomodoro.EndBreakCount)
                {
                    changeIntervalType();
                }
            }

            cpsBar.Value = 0;
            cpsBar.Text  = CurrentInterval.ToString(@"mm\:ss");

            updateSounds();
            updateTheme();
            updateTodayDesign();
        }
Exemplo n.º 3
0
 private void Save_Click(object sender, EventArgs e)
 {
     FilePomodoro.WriteToday();
 }