Exemplo n.º 1
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            TimerCountDown.Stop();

            try
            {
                timeTick.setTimeInt(textBoxHour.Text, textBoxMin.Text, textBoxSec.Text);
                numRepeat          = int.Parse(textBoxRepeat.Text);
                timeTick.totalTime = 0;
                countDownCurrent   = timeTick.hour * 3600 + timeTick.min * 60 + timeTick.sec;

                if (timeTick.hour * 3600 + timeTick.min * 60 + timeTick.sec > 0 && timeTick.min <= 60 && timeTick.sec <= 60)
                {
                    memory.addHistoryList(textBoxHour.Text, textBoxMin.Text, textBoxSec.Text, textBoxRepeat.Text);
                    memory.updateListView(listViewHistory, "history");


                    TimerCountDown.Interval = 1000;
                    TimerCountDown.Start();
                    toggleAvaliabilityTextbox(false);
                }

                else
                {
                    MessageBox.Show("Please enter a valid value", "Error", MessageBoxButtons.OK);
                    initialise("countdown");
                }
            }

            catch
            {
                MessageBox.Show("Please enter positive integers to all textBoxes", "Error", MessageBoxButtons.OK);
                initialise("countdown");
            }
        }
Exemplo n.º 2
0
 private void ButtonStopBackup_Click(object sender, EventArgs e)
 {
     if (ButtonStopBackup.Text == "停止備份")
     {
         ButtonStopBackup.Text = "繼續備份";
         TimerFreq.Stop();
         TimerCountDown.Stop();
     }
     else
     {
         ButtonStopBackup.Text = "停止備份";
         TimerFreq.Start();
         TimerCountDown.Start();
     }
 }
Exemplo n.º 3
0
        private void Finished()
        {
            TimerFreq.Enabled  = true;
            TimerFreq.Interval = Frequency;
            TimerFreq.Start();
            TimerCountDown.Enabled  = true;
            TimerCountDown.Interval = 1000;
            TimerCountDown.Start();

            ButtonStopBackup.Enabled = true;
            sFrequency = Frequency / 1000;
            FromPath   = TextBoxFrom.Text;
            ToPath     = TextBoxTo.Text;
            MessageBox.Show("已完成設定,目前會以「" + ComboBoxFreq.SelectedItem + "」的頻率備份。", "完成");
        }//Run this after backup setup
Exemplo n.º 4
0
        private void checkTiming_Tick(object sender, EventArgs e)
        {
            timeTick.updateTime(countDownCurrent);
            Console.WriteLine(countDownCurrent);
            updateTextBoxes();

            if (countDownCurrent > 0)
            {
                countDownCurrent--;
            }

            if (countDownCurrent == 0)
            {
                if (numRepeat == 1)
                {
                    TimerCountDown.Stop();
                    toggleAvaliabilityTextbox(true);
                    MessageBox.Show(memory.listHistory.Last() + " has elapsed", "Timing has Ended", MessageBoxButtons.OK);
                    timeTick.totalTime = 0;
                }


                if (numRepeat > 1)
                {
                    numRepeat--;
                    countDownCurrent = timeTick.totalTime;


                    setTextBoxes(memory.getSplittedTime(memory.listHistory.Count() - 1, "history"));
                    timeTick.setTimeList(memory.getSplittedTime(memory.listHistory.Count() - 1, "history"));
                    TimerCountDown.Stop();

                    if (MessageBox.Show(memory.listHistory.Last() + " has elapsed. " + "Repeating " + numRepeat.ToString() + " more times", "Timing has Ended", MessageBoxButtons.OK) == DialogResult.OK)
                    {
                        TimerCountDown.Interval = 1000;
                        TimerCountDown.Start();
                    }
                }
            }
        }