示例#1
0
文件: AddTimer.cs 项目: dgets/DANT2a
        private void btnAddTimer_Click(object sender, EventArgs e)
        {
            EntryType.Timer godOuah = new EntryType.Timer();

            if (tbxName.Text.Equals(Properties.Resources.InactiveNameTbx))
            {
                MessageBox.Show(Properties.Resources.NoNameSetError,
                                Properties.Resources.NoTextError,
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if ((nudHrs.Value == 0) && (nudMin.Value == 0) && (nudSec.Value == 0))
            {
                MessageBox.Show("Timer cannot be for null countdown!",
                                "Timer Set for Zero", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            godOuah.Name     = tbxName.Text;
            godOuah.Duration = new TimeSpan((int)nudHrs.Value, (int)nudMin.Value,
                                            (int)nudSec.Value);
            godOuah.Remaining = godOuah.Duration;
            //need to set soundbite after we get that set up on the form, too

            mainForm.AddActiveTimer(godOuah);

            this.Close();
        }
示例#2
0
        public void AddActiveTimer(EntryType.Timer newTm)
        {
            activeTimers.Add(newTm);

            //display update
            Display.updateDisplay(EntryType.Entries.Timer);
        }