Ejemplo n.º 1
0
        public void TestKeyboard()
        {
            TimeSpan     ts       = new TimeSpan();
            KeybordTimer keyboard = new KeybordTimer("F1");

            Assert.IsNotNull(keyboard.GetCurrentTime());
        }
Ejemplo n.º 2
0
 //what happens when the start race button is pressed
 private void StartRace(object sender, EventArgs e)
 {
     //ensure we have a timing devices, one is set by default
     if (timingDevice == null)
     {
         RadioButton rb = gbTimerOptions.Controls.OfType<RadioButton>().FirstOrDefault(r=>r.Checked);
         if (rb != null) {
         switch(rb.Name)
         {
             case "radioButtonKB":
                 var timer = new KeybordTimer(comboBoxKeySelect.SelectedText);
                 this.SetTimingDevice(timer);
                 //add key event
                 KeyDown += timer.keyHandler;
                 break;
             case "radioButtonTM":
                     if (comPortComboBox.SelectedItem != null)
                         ValidateTimeMachine();
                 break;
             default:
                 this.SetTimingDevice(new KeybordTimer(comboBoxKeySelect.SelectedText));
                 break;
         }
     }
     }
     //note! this is different from else, we want this to run so long as not null (should be based on above)
     if (timingDevice != null)
     {
         timingDevice.StartRace(GetClockTime());
         ClockEditable(false);
     }
     //the clock should run for timers (except for the time machine becouse it is an external clock and we cant pull this data...)
     if(!radioButtonTM.Checked)
     {
         //this should refresh the clock that the user sees
         clockRefreshTimer.Enabled = true;
     }
     //disable Start buton, enable stop
     btnStartRace.Enabled = false;
     btnEndRace.Enabled = true;
 }
Ejemplo n.º 3
0
 //creates and assigns keybord timer when the kebord radio button is selected
 private void RadioButtonKB_CheckedChanged(object sender, EventArgs e)
 {
     if(radioButtonKB.Checked)
     {
         var timer = new KeybordTimer(comboBoxKeySelect.SelectedText);
         this.SetTimingDevice(timer);
         this.btnStartRace.Enabled = true;
         KeyDown+=timer.keyHandler;
     }
     else
     {
         //remove the key event
         var timer = timingDevice as KeybordTimer;
         if(timer!=null)
             KeyDown -= timer.keyHandler;
     }
 }
Ejemplo n.º 4
0
 public void TestKeyboard()
 {
     TimeSpan ts = new TimeSpan();
     KeybordTimer keyboard = new KeybordTimer("F1");
     Assert.IsNotNull(keyboard.GetCurrentTime());
 }