private void LapSectorCompletedEvent(object sender, LapInfo.SectorCompletedArgs e)
        {
            SectorTiming completedSector = e.SectorTiming;

            if (!e.SectorTiming.Lap.Valid)
            {
                return;
            }

            switch (completedSector.SectorNumber)
            {
            case 1:
                if ((BestSector1 == null || BestSector1.Duration > completedSector.Duration) && completedSector.Duration != TimeSpan.Zero)
                {
                    BestSector1 = completedSector;
                }
                break;

            case 2:
                if ((BestSector2 == null || BestSector2.Duration > completedSector.Duration) && completedSector.Duration != TimeSpan.Zero)
                {
                    BestSector2 = completedSector;
                }
                break;

            case 3:
                if ((BestSector3 == null || BestSector3.Duration > completedSector.Duration) && completedSector.Duration != TimeSpan.Zero)
                {
                    BestSector3 = completedSector;
                }
                break;
            }
            OnSectorCompletedEvent(e);
        }
Exemple #2
0
 public StaticLapInfo(int lapNumber, TimeSpan lapTime, bool firstLap, ILapInfo previousLap, double completedDistance, DriverTiming driver)
 {
     LapNumber         = lapNumber;
     LapTime           = lapTime;
     FirstLap          = firstLap;
     PreviousLap       = previousLap;
     CompletedDistance = completedDistance;
     Driver            = driver;
     Sector1           = new SectorTiming(1, TimeSpan.Zero, this);
     Sector2           = new SectorTiming(2, TimeSpan.Zero, this);
     Sector3           = new SectorTiming(3, TimeSpan.Zero, this);
     LapTelemetryInfo  = null;
 }
        public SectorTiming GetSector3Timing()
        {
            if (CurrentLap == null)
            {
                return(null);
            }
            SectorTiming sector = CurrentLap.Sector3;

            if (sector == null && CurrentLap.PreviousLap != null)
            {
                sector = CurrentLap.PreviousLap.Sector3;
            }
            return(sector);
        }
Exemple #4
0
 public SectorCompletedArgs(SectorTiming sectorTiming)
 {
     SectorTiming = sectorTiming;
 }
 public bool HasValidTimingInformation(DriverInfo driverInfo)
 {
     return(SectorTiming.PickTimingFormDriverInfo(driverInfo, Sector.SectorNumber) > TimeSpan.Zero);
 }
 public PendingSector(SectorTiming sector, TimeSpan initializationTime)
 {
     Sector = sector;
     Sector.SwitchToPending(initializationTime);
     _initializationTime = initializationTime;
 }
 public PendingSector(SectorTiming sector, TimeSpan initializationTime)
 {
     Sector = sector;
     _initializationTime = initializationTime;
 }