Пример #1
0
        public override void ExamineFlight(ExaminerFlightRow cfr)
        {
            if (cfr == null)
            {
                throw new ArgumentNullException("cfr");
            }

            // No training devices for sport pilots
            if (!cfr.fIsRealAircraft)
            {
                return;
            }

            // Minimum time can be in anything
            miMinTime.AddEvent(cfr.Total);

            // Everything else must be in matching category/class
            // allow perfect match or ASEL->ASES match
            if (CatClassID != cfr.idCatClassOverride && !(CatClassID == CategoryClass.CatClassID.ASEL && cfr.idCatClassOverride == CategoryClass.CatClassID.ASES))
            {
                return;
            }

            miMinInstruction.AddEvent(cfr.Dual);
            decimal soloTime = 0.0M;

            cfr.ForEachEvent(pf => { if (pf.PropertyType.IsSolo)
                                     {
                                         soloTime += pf.DecValue;
                                     }
                             });
            miMinSolo.AddEvent(soloTime);

            int cFSLandings = cfr.cFullStopLandings + cfr.cFullStopNightLandings;

            miMinCrossCountry.AddEvent(Math.Min(cfr.XC, cfr.Dual));
            miMinLandings.AddEvent(cFSLandings);
            if (soloTime > 0 && cFSLandings > 1)
            {
                AirportList al = AirportListOfRoutes.CloneSubset(cfr.Route, true);

                if (al.DistanceForRoute() > MinXCDistance && al.MaxSegmentForRoute() > 25)
                {
                    miSoloXCFlight.AddEvent(1);
                    miSoloXCFlight.MatchingEventID   = cfr.flightID;
                    miSoloXCFlight.MatchingEventText = String.Format(CultureInfo.CurrentCulture, Resources.MilestoneProgress.MatchingXCFlightTemplate, cfr.dtFlight.ToShortDateString(), cfr.Route);
                }
            }

            if (DateTime.Now.AddCalendarMonths(-2).CompareTo(cfr.dtFlight) <= 0)
            {
                miTestPrep.AddEvent(cfr.Dual);
            }
        }