public Windows_JouerMatch(List <Match> matchs) { InitializeComponent(); cbJingleBut.IsChecked = true; _media = new MediaWAV(); _enCours = new List <bool>(); _matchs = matchs; _tour = _matchs[0].Round; Matchs(); foreach (Match m in _matchs) { _enCours.Add(true); } _media.Ambiance4000(); try { imgEquipe1.Source = new BitmapImage(new Uri(Utils.Logo(_matchs[0].home))); imgEquipe2.Source = new BitmapImage(new Uri(Utils.Logo(_matchs[0].away))); } catch { //So we don't show any logo if club has no logo } lbEquipe1.Content = _matchs[0].home; lbEquipe2.Content = _matchs[0].away; //Thread t = new Thread(new ThreadStart(ThreadMatch)); for (int i = 0; i < _matchs.Count; i++) { int j = i; Thread t = new Thread(() => ThreadMatch(_matchs[j])); t.Start(); } }
private void BtnSimuler_Click(object sender, RoutedEventArgs e) { for (int i = 0; i < _matchs.Count; i++) { Match match = _matchs[i]; bool termine = false; while (!termine) { List <RetourMatch> rm = match.NextMinute(); if (Utils.RetoursContient(RetourMatchEvenement.FIN_MATCH, rm)) { termine = true; } } //_matchs[i].Jouer(); } //while (!Utils.RetoursContient(RetourMatchEvenement.FIN_MATCH, _matchs[0].MinuteSuivante())) ; _media.Detruire(); _media = null; Close(); }