예제 #1
0
        //wenn der Nutzer auf Turnier starten klickt, werden die Elemente fuer das Eintragen der Ergebnisse eingeblendet
        private void b_start_tournament_Click(object sender, RoutedEventArgs e)
        {
            b_start_tournament.Visibility = Visibility.Hidden;
            b_start.Visibility            = Visibility.Hidden;
            b_stop.Visibility             = Visibility.Hidden;
            l_title.Visibility            = Visibility.Visible;
            i_pitch.Visibility            = Visibility.Visible;
            tbl_team1.Visibility          = Visibility.Visible;
            tbl_team2.Visibility          = Visibility.Visible;
            tbl_nr_set.Visibility         = Visibility.Visible;
            tb_team1.Visibility           = Visibility.Visible;
            tb_team2.Visibility           = Visibility.Visible;
            b_continue.Visibility         = Visibility.Visible;
            b_home.Visibility             = Visibility.Visible;
            tbl_chance_team1.Visibility   = Visibility.Visible;
            tbl_chance_team2.Visibility   = Visibility.Visible;

            try
            {
                tournament.StartTournament();
                teams                 = tournament.CurrentMatch.GetTeams();
                tbl_team1.Text        = teams.ElementAt(0).ToString();
                tbl_team2.Text        = teams.ElementAt(1).ToString();
                tbl_chance_team1.Text = "Gewinnchance: \n" +
                                        (tournament.CurrentMatch.GetWinExpectationThatTeamAWins()).ToString() + " %";
                tbl_chance_team2.Text = "Gewinnchance: \n" +
                                        (tournament.CurrentMatch.GetWinExpectationThatTeamBWins()).ToString() + " %";
            }
            catch (Exception ex)
            {
                if (ex is ArgumentOutOfRangeException)
                {
                    MessageBox.Show(
                        "Teilnehmeranzahl ist nicht korrekt für den ausgewählten Spielmodus " +
                        ApplicationState.GetValue <TournamentPers>("CurrentTournament").Gamemode + ".", "KICKERCUP",
                        MessageBoxButton.OK, MessageBoxImage.Information);
                }
                else
                {
                    MessageBox.Show("Es ist ein schwerer Fehler aufgetreten");
                }

                if (this.NavigationService.CanGoBack)
                {
                    this.NavigationService.GoBack();
                }
                else
                {
                    Tournament_Competitors tc = new Tournament_Competitors();
                    this.NavigationService.Navigate(tc);
                }
            }
        }