コード例 #1
0
        void btnPlay_Click(object sender, RoutedEventArgs e)
        {
            switch (etat_tournois)
            {
            case 0:
                Manager.launchHuitieme(listMatch);
                var listQuart = (from mat in listMatch
                                 where mat.PhaseTournoi == EPhaseTournoi.QuartFinale
                                 orderby mat.Match.Id
                                 select mat).ToList();

                k1.Text = listQuart[0].Jedi1.Nom;
                k2.Text = listQuart[0].Jedi2.Nom;
                k3.Text = listQuart[1].Jedi1.Nom;
                k4.Text = listQuart[1].Jedi2.Nom;
                k5.Text = listQuart[2].Jedi1.Nom;
                k6.Text = listQuart[2].Jedi2.Nom;
                k7.Text = listQuart[3].Jedi1.Nom;
                k8.Text = listQuart[3].Jedi2.Nom;
                this.etat_tournois++;
                break;

            case 1:
                Manager.launchQuart(listMatch);
                var listDemi = (from mat in listMatch
                                where mat.PhaseTournoi == EPhaseTournoi.DemiFinale
                                orderby mat.Match.Id
                                select mat).ToList();
                l1.Text = listDemi[0].Jedi1.Nom;
                l2.Text = listDemi[0].Jedi2.Nom;
                l3.Text = listDemi[1].Jedi1.Nom;
                l4.Text = listDemi[1].Jedi2.Nom;

                this.etat_tournois++;
                break;

            case 2:
                Manager.launchDemi(listMatch);
                var listFinale = (from mat in listMatch
                                  where mat.PhaseTournoi == EPhaseTournoi.Finale
                                  orderby mat.Match.Id
                                  select mat).ToList();
                m1.Text = listFinale[0].Jedi1.Nom;
                m2.Text = listFinale[0].Jedi2.Nom;
                this.etat_tournois++;
                break;

            case 3:
                Match matc = (from match in listMatch
                              where match.PhaseTournoi == EPhaseTournoi.Finale
                              select match.Match).First();
                Manager.launchFinale(matc);
                v1.Text = (from vainc in Manager.getAllJediModel()
                           where vainc.Jedi.Id == matc.IdJediVainqueur
                           select vainc.Nom).First();
                this.etat_tournois++;
                button.Content = "Close";
                break;

            case 4:
                this.Close();
                break;
            }
        }