Exemplo n.º 1
0
 private void TimerToggleEvent(object sender, SerialTimerEventArgs args)
 {
     if (args.High)
     {
         _pressed = true;
         _resetStopwatch.Start();
     }
     else
     {
         if (_resetStopwatch.Elapsed >= _threshHoldTimeSpan)
         {
             Application.Current.Dispatcher.Invoke(() =>
             {
                 _stopwatch.Stop();
                 _timer.Stop();
                 ButtonToggleState.Content = "Start";
                 _stopwatch.Reset();
                 UpdateTimer();
             });
         }
         else if (_pressed)
         {
             Application.Current.Dispatcher.Invoke(ToggleTimer);
             _pressed = false;
         }
         _resetStopwatch.Reset();
     }
 }
Exemplo n.º 2
0
 private void SnaptimeEvent(object sender, SerialTimerEventArgs args)
 {
     if (args.High)
     {
         Application.Current.Dispatcher.Invoke(() =>
         {
             if (_excel == null)
             {
                 _excel = new Excel(_settingsWindow.TextBoxPath.Text, 1);
             }
         });
     }
 }