Пример #1
0
        private void MatchEditData_Click(object sender, RoutedEventArgs e)
        {
            int   index        = (int)((Button)sender).Tag;
            Round currentRound = null;

            if (CurrentMode.Content == "playoff")
            {
                currentRound = CurrentTournament.PlayOff.FindRound((string)PlayoffRoundNameHidden.Tag);
            }
            else if (CurrentMode.Content == "match")
            {
                currentRound = CurrentTournament.League.FindRound((string)RoundNameHidden.Tag);
            }
            TournamentManager.TMatch.Match match = currentRound.ListMatches[index];

            CollapseAllGrids();
            MatchEditDataGrid.Visibility = Visibility.Visible;

            MatchIndexHidden.Content = index;

            ChooseTeamA.Content = match.TeamA.Name;
            ChooseTeamB.Content = match.TeamB.Name;

            Stat2.Visibility = Visibility.Collapsed;
            Stat3.Visibility = Visibility.Collapsed;
            Stat4.Visibility = Visibility.Collapsed;
            Stat5.Visibility = Visibility.Collapsed;
            Stat6.Visibility = Visibility.Collapsed;

            if (match is VolleyballMatch)
            {
                Stat2.Visibility = Visibility.Visible;
                Stat3.Visibility = Visibility.Visible;
                Stat4.Visibility = Visibility.Visible;
                Stat5.Visibility = Visibility.Visible;
                Stat6.Visibility = Visibility.Visible;

                Stat1.Text = match.TeamA.Name + " - Set 1";
                Stat2.Text = match.TeamA.Name + " - Set 2";
                Stat3.Text = match.TeamA.Name + "- Set 3";
                Stat4.Text = match.TeamB.Name + " - Set 1";
                Stat5.Text = match.TeamB.Name + "- Set 2";
                Stat6.Text = match.TeamB.Name + " - Set 3";
            }
            else if (match is TugOfWarMatch)
            {
                Stat1.Text = "Czas Meczu";
            }
            else if (match is DodgeballMatch)
            {
                Stat1.Text = "Ilość pozostałych graczy zwycięskiej drużyny";
            }
        }
Пример #2
0
        private void MatchDetailsPreview_Click(object sender, RoutedEventArgs e)
        {
            CollapseAllGrids();
            MatchDetailsGrid.Visibility = Visibility.Visible;
            int   index        = (int)((Button)sender).Tag;
            Round currentRound = null;

            if (CurrentMode.Content == "playoff")
            {
                currentRound = CurrentTournament.PlayOff.FindRound((string)PlayoffRoundNameHidden.Tag);
            }
            else if (CurrentMode.Content == "match")
            {
                currentRound = CurrentTournament.League.FindRound((string)RoundNameHidden.Tag);
            }

            TournamentManager.TMatch.Match match = currentRound.ListMatches[index];

            DetailTeamA.Content = match.TeamA.Name;
            DetailTeamB.Content = match.TeamB.Name;
            List <Referee> referees = match.GetReferees();

            DetailRefereeA.Content = referees[0].Fullname + ", " + referees[0].Age + " lat";
            try
            {
                DetailRefereeB.Content = referees[1].Fullname + ", " + referees[1].Age + " lat";
                DetailRefereeC.Content = referees[2].Fullname + ", " + referees[2].Age + " lat";
            }
            catch (ArgumentOutOfRangeException) { }

            if (match.Winner != null)
            {
                if (match.Winner.Name == match.TeamA.Name)
                {
                    DetailResultA.Content    = "ZWYCIĘZCA";
                    DetailResultA.Foreground = Brushes.Green;
                    DetailResultB.Content    = "PRZEGRANY";
                    DetailResultB.Foreground = Brushes.Red;
                }
                else if (match.Winner.Name == match.TeamB.Name)
                {
                    DetailResultB.Content    = "ZWYCIĘZCA";
                    DetailResultB.Foreground = Brushes.Green;
                    DetailResultA.Content    = "PRZEGRANY";
                    DetailResultA.Foreground = Brushes.Red;
                }
                else
                {
                    DetailResultA.Content = "";
                    DetailResultB.Content = "";
                }

                if (match.IsWalkover && match.Winner.Name != match.TeamA.Name)
                {
                    DetailResultA.Content    = "PODDAŁ SIĘ";
                    DetailResultA.Foreground = Brushes.Red;
                }
                else if (match.IsWalkover && match.Winner.Name != match.TeamB.Name)
                {
                    DetailResultB.Content    = "PODDAŁ SIĘ";
                    DetailResultB.Foreground = Brushes.Red;
                }
            }
            else
            {
                DetailResultA.Content = "";
                DetailResultB.Content = "";
            }

            string[] statsA = match.TeamA.GetStats().Split(", ");
            string[] statsB = match.TeamB.GetStats().Split(", ");

            DetailTeamAStatA.Content = statsA[0];
            DetailTeamAStatB.Content = statsA[1];
            DetailTeamAStatC.Content = statsA[2];

            DetailTeamBStatA.Content = statsB[0];
            DetailTeamBStatB.Content = statsB[1];
            DetailTeamBStatC.Content = statsB[2];

            if (match is VolleyballMatch)
            {
                DetailStatA.Content = "Ilość Punktów";
                DetailStatB.Content = "Wygrane Mecze";
                DetailStatC.Content = "Różnica Małych Punktów";
            }
            else if (match is TugOfWarMatch)
            {
                DetailStatA.Content = "Wygrane Mecze";
                DetailStatB.Content = "Średni Czas Wygrywania";
                DetailStatC.Content = "Średni Czas Przegrywania";
            }
            else if (match is DodgeballMatch)
            {
                DetailStatA.Content = "Wygrane Mecze";
                DetailStatB.Content = "Ilość Wyeliminowanych Graczy";
                DetailStatC.Content = "Ilość Pozostałych Graczy";
            }
        }