コード例 #1
0
        /// <summary>
        /// Apply the raw results to the model and save to disk.
        /// </summary>
        private bool SaveRawEventResults()
        {
            List <IRaw> rawList = new List <IRaw>();

            foreach (RawResults result in AllAthletes.FindAll(athlete => athlete.RaceNumber != string.Empty))
            {
                rawList.Add(new Raw(result.RaceNumber, result.RaceTime, result.Order));
            }

            return(this.handicapEventModel.SaveRawResults(rawList));
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        private void RegisterNewResult(string raceNumber, RaceTimeType raceTime)
        {
            RawResults result = this.FindAthlete(raceNumber);

            if (result != null)
            {
                result.RaceNumber = raceNumber;
                result.RaceTime   = raceTime;

                // Determine the finish order if two or more athletes share the same finishing time.
                List <RawResults> filteredList = AllAthletes.FindAll(athlete => athlete.RaceTime == result.RaceTime);
                result.Order = filteredList.Count();

                ResetMemberData();

                RaisePropertyChangedEvent("UnregisteredAthletes");
                RaisePropertyChangedEvent("RegisteredAthletes");
            }
            else
            {
                // The athlete is unknown. Add the data to all athletes, all athletes is read
                // when saving the raw results.
                ObservableCollection <string> newNumber = new ObservableCollection <string> {
                    raceNumber
                };
                RawResults newResult = new RawResults(0, string.Empty, newNumber);
                newResult.RaceTime   = raceTime;
                newResult.RaceNumber = raceNumber;

                // Determine the finish order if two or more athletes share the same finishing time.
                List <RawResults> filteredList = AllAthletes.FindAll(athlete => athlete.RaceTime == raceTime);
                newResult.Order = filteredList.Count();

                this.AllAthletes.Add(newResult);
            }
        }