private void StopWatch_LapTimeUpdated(object sender, LapEventArgs e) { TimeSpan?dateTime = e.LapTime; if (dateTime.HasValue) { LapSeconds = (int)dateTime.Value.Seconds; LapMinutes = (int)dateTime.Value.Minutes; LapHours = (int)dateTime.Value.Hours; } }
private void LapTimeUpdatedEventHandler(object sender, LapEventArgs e) { if (_lastLapHours != LapHours) { FirePropertyChanged(LapHours, ref _lastLapHours, "LapHours"); } if (_lastLapMinutes != LapMinutes) { FirePropertyChanged(LapMinutes, ref _lastLapMinutes, "LapMinutes"); } if (_lastLapSeconds != LapSeconds) { FirePropertyChanged(LapSeconds, ref _lastLapSeconds, "LapSeconds"); } }
private void LapTimeUpdatedEventHandler(object sender, LapEventArgs e) { if (_lastLapHours != LapHours) { _lastLapHours = LapHours; OnPropertyChanged("LapHours"); } if (_lastLapMinutes != LapMinutes) { _lastLapMinutes = LapMinutes; OnPropertyChanged("LapMinutes"); } if (_lastLapSeconds != LapSeconds) { _lastLapSeconds = LapSeconds; OnPropertyChanged("LapSeconds"); } }
private void _stopwatch_LapTimeUpdated(object sender, LapEventArgs e) { if (_lapLastHours != LapHours) { _lapLastHours = LapHours; OnPropertyChanged("LapHours"); } if (_lapLastMinutes != LapMinutes) { _lapLastMinutes = LapMinutes; OnPropertyChanged("LapMinutes"); } if (_lapLastSeconds != LapSeconds) { _lapLastSeconds = LapSeconds; OnPropertyChanged("LapSeconds"); } }
private void lapTimer_SectorComplete(LapTimer sender, LapEventArgs args) { Dispatcher.BeginInvoke(() => { var sectorSplit = args.Lap.EndElapsedTime - lapStartElapsed; var bestLapSectorTime = bestLapSectors.Any() ? bestLapSectors[args.Lap.SectorNumber] : (TimeSpan?)null; if (bestLapSectorTime.HasValue) { var sectorTimeDifference = sectorSplit - bestLapSectorTime.Value; CurrentLapStatus = sectorTimeDifference; } else { CurrentLapStatus = TimeSpan.Zero; } }); }
private void lapTimer_LapComplete(LapTimer sender, LapEventArgs args) { Dispatcher.BeginInvoke(() => { lapStartElapsed = args.Lap.EndElapsedTime; Laps.Insert(0, args.Lap); LapCount = args.Lap.LapNumber + 1; if ((bestLapSectors == null || !bestLapSectors.Any()) && lapTimer.GenerateSectors && lapTimer.SectorCoordinates != null && lapTimer.SectorCoordinates.Any()) { trackSectors = lapTimer.SectorCoordinates; SetBestLapSectorsFromLap(args.Lap); CurrentLapStatus = TimeSpan.Zero; return; } if (bestLapSectors == null || !bestLapSectors.Any()) { SetBestLapSectorsFromLap(args.Lap); } var bestLapSectorTime = bestLapSectors.Any() ? bestLapSectors[args.Lap.SectorNumber] : (TimeSpan?)null; if (bestLapSectorTime.HasValue) { var sectorTimeDifference = args.Lap.LapTime - bestLapSectorTime.Value; CurrentLapStatus = sectorTimeDifference; if (sectorTimeDifference < TimeSpan.Zero) { SetBestLapSectorsFromLap(args.Lap); } } else { SetBestLapSectorsFromLap(args.Lap); CurrentLapStatus = TimeSpan.Zero; } }); }
protected virtual void OnLapCompleted(LapEventArgs e) { LapCompleted?.Invoke(this, e); }
protected virtual void OnLapInvalidated(LapEventArgs e) { RevertSectorChanges(e.Lap); LapInvalidated?.Invoke(this, e); }
protected virtual void OnNewLapStarted(LapEventArgs e) { NewLapStarted?.Invoke(this, e); }
private void LapInvalidatedHandler(object sender, LapEventArgs e) { OnLapInvalidated(e); }
private void LapCompletedHandler(object sender, LapEventArgs e) { OnLapCompleted(e); }