Esempio n. 1
0
 /// <summary>
 /// When you are in Split mode and you press your split button.
 /// </summary>
 private void DoSplit()
 {
     segmentWatchColor = SettingsLayout.Default.SegmentTimerRunningColor;
     if (split.RunStatus == RunStatus.STOPPED)
     {
         StartTimer();
         StartSegmentTimer();
         split.StartRun();
     }
     else if (split.RunStatus == RunStatus.ON_GOING && watch.IsRunning)
     {
         double splitTime   = Math.Truncate(watch.Elapsed.TotalSeconds * 100) / 100;
         double segmentTime = (Math.Truncate(segmentWatch.Elapsed.TotalSeconds * 100) / 100) + timeElapsedSinceSplit;
         if (!split.CurrentSplitIsLastSplit())
         {
             split.DoSplit(splitTime, segmentTime);
         }
         else
         {
             split.DoSplit(splitTime, segmentTime);
             split.CompleteRun();
             runTimeOnCompletionPause     = watch.Elapsed;
             segmentTimeOnCompletionPause = segmentTime;
             watchColor        = SettingsLayout.Default.TimerPausedColor;
             segmentWatchColor = SettingsLayout.Default.SegmentTimerPausedColor;
         }
         segmentWatch.Restart();
     }
     else if (split.RunStatus == RunStatus.DONE)
     {
         split.SaveRun();
         ResetTimer();
         ResetSegmentTimer();
     }
     timeElapsedSinceSplit = 0;
 }