Exemple #1
0
        private void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            resultsWorker.DoWork += new DoWorkEventHandler(resultsWorker_DoWork);
            resultsWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(resultsWorker_RunWorkerCompleted);

            ResultsServices cmd = new ResultsServices();
            this.cmbGPs.DataContext = cmd.GetAllGPs();

            this.LoadTeams();
            this.LoadOrders();

            this.timer.Start();
        }
Exemple #2
0
        private void resultsWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            ResultsServices rCmdr = new ResultsServices();
            GrandPrix gp = (GrandPrix)e.Argument;
            IList<RaceResult> results = rCmdr.GetRaceResults(2010, gp);

            IList<Team> playableTeams = teams.Where(x => x.IsPlayable == true).ToList();
            foreach (var item in playableTeams)
            {
                results = rCmdr.CalculateTeamResult(item, results);
            }
            e.Result = results;
        }
 /// <summary>
 /// Gets all thr Grand Prix in the system.
 /// </summary>
 /// <returns>A list of Grand Prix.</returns>
 public IList<GrandPrix> GetAllGPs()
 {
     ResultsServices resSrv = new ResultsServices();
     return resSrv.GetAllGPs();
 }
 /// <summary>
 /// Gets the race results.
 /// </summary>
 /// <param name="season">The season.</param>
 /// <param name="gp">The Grand Prix.</param>
 /// <returns>A list of RaceResults.</returns>
 public IList<RaceResult> GetRaceResults(int season, GrandPrix gp)
 {
     ResultsServices resSvc = new ResultsServices();
     return resSvc.GetRaceResults(season, gp);
 }
 /// <summary>
 /// Calculates the team result.
 /// </summary>
 /// <param name="team">The team wich results are going to be calculated.</param>
 /// <param name="grandPrixResult">The grand prix real results.</param>
 /// <returns>A list of Race Results (one per car).</returns>
 public IList<RaceResult> CalculateTeamResult(Team team, IList<RaceResult> grandPrixResult)
 {
     ResultsServices resSvc = new ResultsServices();
     return resSvc.CalculateTeamResult(team, grandPrixResult);
 }