Example #1
0
 private void btnGo_Click(object sender, System.EventArgs e)
 {
     if(txtName.Text=="") txtName.Text="Unnamed timer";
     _TeaTimer oTT=new _TeaTimer(txtName.Text,(int)numDay.Value,(int)numHour.Value,(int)numMin.Value,(int)numSec.Value);
     oTT.Tick += new EventHandler(teaTimer_Tick);
     oTT.AudibleAlert=((_SimpleDataStructure)cmbTimerSnd.SelectedItem).sFile;
     oTT.VisualAlert=((_SimpleDataStructure)cmbTimerIcon.SelectedItem).sFile;
     oTT.ProcessAlert=((_SimpleDataStructure)cmbTimerProcess.SelectedItem).sFile;
     oTT.Recurring=cbxTimerRepeat.Checked;
     addTimer(oTT);
     resetForm();
 }
Example #2
0
        //preset clicked
        private void btnPre_Click(object sender, System.EventArgs e)
        {
            int i=(sender.GetType().Equals((new Button()).GetType())?
                Convert.ToInt32(((Button)sender).Tag):
                iconMenu.MenuItems.IndexOf(menPresets)+Convert.ToInt32(((MenuItem)sender).Text.Substring(1,1))
                )-1;

            _TeaTimer oTT=new _TeaTimer(_oPresets[i].sName,_oPresets[i].iDay,_oPresets[i].iHour,_oPresets[i].iMin,_oPresets[i].iSec);
            oTT.AudibleAlert=(_oPresets[i].bDefSnd?((_Sound)lstSounds.Items[0]).sFile:_oPresets[i].sSnd);
            oTT.VisualAlert=(_oPresets[i].bDefIcon?((_Icon)lstIcons.Items[0]).sFile:_oPresets[i].sIcon);
            oTT.ProcessAlert=_oPresets[i].sProcess;
            oTT.Recurring=_oPresets[i].bRecurring;
            oTT.Tick += new EventHandler(teaTimer_Tick);
            addTimer(oTT);
        }
Example #3
0
 private void showStopwatch(_TeaTimer oTT)
 {
     new Stopwatch(oTT,this,(_iStopwatchOpacity/100.0));
 }
Example #4
0
 private void btnAlarmGo_Click(object sender, System.EventArgs e)
 {
     if(txtAlarmName.Text=="")txtAlarmName.Text="Unnamed alarm";
     DateTime oAlarm=new DateTime(
         calAlarm.SelectionStart.Year,calAlarm.SelectionStart.Month,calAlarm.SelectionStart.Day,
         (int)numAlarmHour.Value+(cbx24hour.Checked?0:(radPM.Checked?12:0)),
         (int)numAlarmMin.Value,(int)numAlarmSec.Value);
     _TeaTimer oTT=new _TeaTimer(txtAlarmName.Text,oAlarm);
     oTT.Tick += new EventHandler(teaTimer_Tick);
     oTT.AudibleAlert=((_SimpleDataStructure)cmbAlarmSnd.SelectedItem).sFile;
     oTT.VisualAlert=((_SimpleDataStructure)cmbAlarmIcon.SelectedItem).sFile;
     oTT.ProcessAlert=((_SimpleDataStructure)cmbAlarmProcess.SelectedItem).sFile;
     try
     {
         addTimer(oTT);
     }
     catch(_TeaTimer.TeaTimerException ex)
     {
         MessageBox.Show("You cannot specify a time in the past!","Error (Tea Timer)",MessageBoxButtons.OK,MessageBoxIcon.Error);
         removeTimer(oTT);
     }
     resetForm();
 }
Example #5
0
        private void addTimerNoAlert(_TeaTimer oTeaTimer)
        {
            timElapsedUpdate.Stop();

            _oTeaTimers.Add(oTeaTimer);
            oTeaTimer.Go();
            rebuildTimersList();
            timElapsedUpdate.Start();
        }
Example #6
0
 private void addTimer(_TeaTimer oTeaTimer)
 {
     addTimerNoAlert(oTeaTimer);
     MessageBox.Show(oTeaTimer.Name+" started.\nDuration: "+getFormattedTime(oTeaTimer.Time)+"\nWill pop on: "+getTimeString(oTeaTimer.Finished),oTeaTimer.Name+" (Tea Timer)",MessageBoxButtons.OK,MessageBoxIcon.Information);
     if(cbxShowStopwatch.Checked) showStopwatch(oTeaTimer);
 }
Example #7
0
 internal void stopTeaTimer(_TeaTimer oTT)
 {
     oTT.Expire();
     removeTimer(oTT);
 }
Example #8
0
 internal void showTimerScreen(_TeaTimer oTT)
 {
     tabControl1.SelectedTab=tabView;
     resetForm();
     lstTimers.SelectedItem=oTT;
     FadeForm(Fade.Up);
 }
Example #9
0
 internal void pauseTeaTimer(_TeaTimer oTT)
 {
     if(oTT.Paused) oTT.Resume();
     else oTT.Pause();
     rebuildTimersList();
 }