/* * Method creates a temporary timer to be utilized before * pushing it onto the active stack of timers */ private Timers createTmpTimer(string[] fields) { if (fields[0] == null) { return null; } if (fields[0].CompareTo("T") != 0) { return null; } Timers tmp = new Timers(); int[] ouah = null; tmp.name = fields[1]; tmp.setRunning(false); ouah = convertSavedFields(fields); tmp.setInterval(ouah[0], ouah[1], ouah[2]); //in hindsight, these should both be set by TimeSpan, not one by //such and the other by 3 integers :P tmp.setOrigInterval(new TimeSpan(ouah[0], ouah[1], ouah[2])); return tmp; }
/* * Method handles adding new timer data to the appropriate List * objects and checklist */ private void btnAddTimer_Click(object sender, EventArgs e) { if (txtTimerName.Text.CompareTo("") == 0) { MessageBox.Show("You must enter a timer name!", "Timer Name Required"); } if (!legitTime((int)numTimerHr.Value, (int)numTimerMin.Value, (int)numTimerSec.Value, false)) { throw new DANTException("Not legit time from legitTime()\n"); } Timers tmpTimer = new Timers(); tmpTimer.name = txtTimerName.Text; tmpTimer.setInterval((int) numTimerHr.Value, (int) numTimerMin.Value, (int) numTimerSec.Value); tmpTimer.setOrigInterval(new TimeSpan((int) numTimerHr.Value, (int) numTimerMin.Value, (int) numTimerSec.Value)); tmpTimer.setRunning(false); tmpTimer.soundBite = soundByteSelection(); grayItemNameBoxNResetNumerics(false); //add it to the list activeTms.Add(tmpTimer); //add timer to the 'active' timers list in the checkboxlist addTimer(activeTms.IndexOf(tmpTimer)); try { saveAlarmsTimers(); } catch { if (fileIODebugging) { Console.WriteLine("Error saving alarms/timers\n"); } throw new DANTException("Error saving alarms/timers"); } }