public LiveTimingAutoNiZ(uint secondsTillAutoNiZ, RaceRun raceRun)
        {
            _secondsTillAutoNiZ = secondsTillAutoNiZ;
            _raceRun            = raceRun;

            startObservation();
        }
        public void Race_IsComplete()
        {
            TestDataGenerator tg = new TestDataGenerator();
            Race    race         = tg.Model.GetRace(0);
            RaceRun rr1          = race.GetRun(0);
            RaceRun rr2          = race.GetRun(1);

            Assert.IsFalse(rr1.IsComplete);

            tg.createRaceParticipants(1);

            Assert.IsFalse(rr1.IsComplete);
            Assert.IsFalse(rr2.IsComplete);
            Assert.IsFalse(race.IsComplete);

            rr1.SetRunTime(race.GetParticipant(1), new TimeSpan(0, 1, 0));
            Assert.IsTrue(rr1.IsComplete);
            Assert.IsFalse(rr2.IsComplete);
            Assert.IsFalse(race.IsComplete);

            rr2.SetRunTime(race.GetParticipant(1), new TimeSpan(0, 1, 0));
            Assert.IsTrue(rr1.IsComplete);
            Assert.IsTrue(rr2.IsComplete);
            Assert.IsTrue(race.IsComplete);

            rr2.DeleteRunResults();
            Assert.IsTrue(rr1.IsComplete);
            Assert.IsFalse(rr2.IsComplete);
            Assert.IsFalse(race.IsComplete);
        }
示例#3
0
        TimeSpan?getAccumulatedTime(RaceRun rr, RunResultWithPosition resWp)
        {
            Race race = rr.GetRace();

            TimeSpan?ts = new TimeSpan();

            for (int i = 0; i < race.GetMaxRun(); i++)
            {
                RaceRun r = race.GetRun(i);
                if (r.Run <= rr.Run)
                {
                    TimeSpan?t = r.GetRunResult(resWp.Participant)?.Runtime;
                    if (t != null && ts != null)
                    {
                        ts = ts + (TimeSpan)t;
                    }
                    else
                    {
                        ts = null;
                    }
                }
            }

            return(ts);
        }
示例#4
0
        private void connectUiToRaceRun(RaceRun raceRun)
        {
            if (raceRun != null)
            {
                if (_viewDisqualifications == null)
                {
                    _viewDisqualifications = new CollectionViewSource();
                    _viewDisqualifications.LiveFilteringProperties.Add(nameof(RunResult.Runtime));
                    _viewDisqualifications.LiveFilteringProperties.Add(nameof(RunResult.ResultCode));
                    _viewDisqualifications.IsLiveFilteringRequested = true;
                }

                _disqualificationsVM          = new DiqualifyVM(raceRun);
                _viewDisqualifications.Source = _disqualificationsVM.GetGridView();

                dgDisqualifications.ItemsSource = _viewDisqualifications.View;
                dgResults.ItemsSource           = raceRun.GetResultViewProvider().GetView();

                cmbResultGrouping.SelectCBItem(raceRun.GetResultViewProvider().ActiveGrouping);
            }
            else
            {
                _disqualificationsVM            = null;
                dgDisqualifications.ItemsSource = null;
                dgResults.ItemsSource           = null;
            }
        }
示例#5
0
        private void CmbRaceRun_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            CBItem  selected        = (sender as ComboBox).SelectedValue as CBItem;
            RaceRun selectedRaceRun = selected?.Value as RaceRun;

            setRaceRun(selectedRaceRun);
        }
示例#6
0
 private void raceRun_OnTrackChanged(RaceRun raceRun, RaceParticipant participantEnteredTrack, RaceParticipant participantLeftTrack, RunResult currentRunResult)
 {
     if (participantEnteredTrack != null)
     {
         _liveTiming.UpdateOnTrack(raceRun, participantEnteredTrack);
         updateNextStarter(raceRun);
     }
 }
        public LiveTimingAutoNaS(uint startersTillAutoNaS, RaceRun raceRun)
        {
            _raceRun             = raceRun;
            _startersTillAutoNaS = startersTillAutoNaS;

            _raceRun.OnTrackChanged += OnTrackChanged;

            _raceRun.InFinishChanged += OnFinishChanged;
        }
示例#8
0
        public void UpdateInFinish(RaceRun raceRun, RaceParticipant rp)
        {
            SetActiveRaceRun(raceRun);

            var results         = ViewUtilities.ViewToList <RaceResultItem>(raceRun.GetRace().GetTotalResultView());
            var rri4Participant = results.FirstOrDefault(rri => rri.Participant == rp);

            scheduleTransfer(new LTTransfer(getXmlEventResult(raceRun, rri4Participant)));
        }
示例#9
0
        public void SetActiveRaceRun(RaceRun raceRun)
        {
            if (_activeRaceRun == raceRun)
            {
                return;
            }

            scheduleTransfer(new LTTransfer(getXmlActiveRun(raceRun)));
            _activeRaceRun = raceRun;
        }
示例#10
0
        private void observeRace()
        {
            RaceRun rLast = null;

            foreach (var r in _race.GetRuns())
            {
                System.Diagnostics.Debug.Assert(rLast == null || rLast.Run < r.Run, "previous run number must be smaller than current run number");
                observeRaceRun(rLast, r);
                rLast = r;
            }
        }
示例#11
0
 private void updateNextStarter(RaceRun raceRun)
 {
     // Find current starter
     foreach (var sle in raceRun.GetStartListProvider().GetViewList())
     {
         if (!raceRun.IsOrWasOnTrack(sle.Participant))
         {
             _liveTiming.UpdateOnStart(raceRun, sle.Participant);
             break;
         }
     }
 }
示例#12
0
        private void setRaceRun(RaceRun rr)
        {
            if (rr == null)
            {
                return;
            }

            _currentRaceRun = rr;
            connectUiToRaceRun(_currentRaceRun);

            cmbRaceRun.SelectCBItem(rr);
        }
        private void updateHandTimingVM()
        {
            RaceRun rr        = cmbCalcRun.SelectedValue as RaceRun;
            var     timeModus = (string)(cmbCalcDeviceStartOrFinish.SelectedItem as CBItem).Value == "Start"
        ? HandTimingVMEntry.ETimeModus.EStartTime : HandTimingVMEntry.ETimeModus.EFinishTime;

            if (_race == null && rr == null)
            {
                return;
            }

            _currentHandTimingVM = _handTimingVMManager.GetHandTimingVM(_race, rr, timeModus);

            dgHandTiming.ItemsSource = _currentHandTimingVM.Items;
            updateButtonEnableState();
        }