Пример #1
0
        public bool StartPlayoffs8(IEnumerable<Player> players)
        {
            this.ClearPlayoffs();

            StartRound = PlayoffRound.Final_8;

            topplayers = players.Where(p => p.Active == true).OrderBy(p => p.Place).ToList();

            if (topplayers.Count() < 16) return false;

            topplayers = topplayers.Take(16);

            Player player01 = topplayers.ElementAt(0);
            Player player02 = topplayers.ElementAt(1);
            Player player03 = topplayers.ElementAt(2);
            Player player04 = topplayers.ElementAt(3);
            Player player05 = topplayers.ElementAt(4);
            Player player06 = topplayers.ElementAt(5);
            Player player07 = topplayers.ElementAt(6);
            Player player08 = topplayers.ElementAt(7);
            Player player09 = topplayers.ElementAt(8);
            Player player10 = topplayers.ElementAt(9);
            Player player11 = topplayers.ElementAt(10);
            Player player12 = topplayers.ElementAt(11);
            Player player13 = topplayers.ElementAt(12);
            Player player14 = topplayers.ElementAt(13);
            Player player15 = topplayers.ElementAt(14);
            Player player16 = topplayers.ElementAt(15);

            Final_8_01 = new Game()
            {
                Player1Alias = player01.Alias,
                Player1Id = player01.Id,
                Player1RaceCorpo = player01.RaceCorpo,
                Player1RaceRunner = player01.RaceRunner,

                Player2Alias = player16.Alias,
                Player2Id = player16.Id,
                Player2RaceCorpo = player16.RaceCorpo,
                Player2RaceRunner = player16.RaceRunner,
            };

            Final_8_02 = new Game()
            {
                Player1Alias = player08.Alias,
                Player1Id = player08.Id,
                Player1RaceCorpo = player08.RaceCorpo,
                Player1RaceRunner = player08.RaceRunner,

                Player2Alias = player09.Alias,
                Player2Id = player09.Id,
                Player2RaceCorpo = player09.RaceCorpo,
                Player2RaceRunner = player09.RaceRunner,
            };

            Final_8_03 = new Game()
            {
                Player1Alias = player04.Alias,
                Player1Id = player04.Id,
                Player1RaceCorpo = player04.RaceCorpo,
                Player1RaceRunner = player04.RaceRunner,

                Player2Alias = player13.Alias,
                Player2Id = player13.Id,
                Player2RaceCorpo = player13.RaceCorpo,
                Player2RaceRunner = player13.RaceRunner,
            };

            Final_8_04 = new Game()
            {
                Player1Alias = player05.Alias,
                Player1Id = player05.Id,
                Player1RaceCorpo = player05.RaceCorpo,
                Player1RaceRunner = player05.RaceRunner,

                Player2Alias = player12.Alias,
                Player2Id = player12.Id,
                Player2RaceCorpo = player12.RaceCorpo,
                Player2RaceRunner = player12.RaceRunner,
            };

            Final_8_05 = new Game()
            {
                Player1Alias = player02.Alias,
                Player1Id = player02.Id,
                Player1RaceCorpo = player02.RaceCorpo,
                Player1RaceRunner = player02.RaceRunner,

                Player2Alias = player15.Alias,
                Player2Id = player15.Id,
                Player2RaceCorpo = player15.RaceCorpo,
                Player2RaceRunner = player15.RaceRunner,
            };

            Final_8_06 = new Game()
            {
                Player1Alias = player07.Alias,
                Player1Id = player07.Id,
                Player1RaceCorpo = player07.RaceCorpo,
                Player1RaceRunner = player07.RaceRunner,

                Player2Alias = player10.Alias,
                Player2Id = player10.Id,
                Player2RaceCorpo = player10.RaceCorpo,
                Player2RaceRunner = player10.RaceRunner,
            };

            Final_8_07 = new Game()
            {
                Player1Alias = player03.Alias,
                Player1Id = player03.Id,
                Player1RaceCorpo = player03.RaceCorpo,
                Player1RaceRunner = player03.RaceRunner,

                Player2Alias = player14.Alias,
                Player2Id = player14.Id,
                Player2RaceCorpo = player14.RaceCorpo,
                Player2RaceRunner = player14.RaceRunner,
            };

            Final_8_08 = new Game()
            {
                Player1Alias = player06.Alias,
                Player1Id = player06.Id,
                Player1RaceCorpo = player06.RaceCorpo,
                Player1RaceRunner = player06.RaceRunner,

                Player2Alias = player11.Alias,
                Player2Id = player11.Id,
                Player2RaceCorpo = player11.RaceCorpo,
                Player2RaceRunner = player11.RaceRunner,
            };

            final_8_01.DiceSystemTop(topplayers);
            final_8_02.DiceSystemTop(topplayers);
            final_8_03.DiceSystemTop(topplayers);
            final_8_04.DiceSystemTop(topplayers);
            final_8_05.DiceSystemTop(topplayers);
            final_8_06.DiceSystemTop(topplayers);
            final_8_07.DiceSystemTop(topplayers);
            final_8_08.DiceSystemTop(topplayers);

            final_8_01.ScoreChanged += final8_ScoreChanged;
            final_8_02.ScoreChanged += final8_ScoreChanged;
            final_8_03.ScoreChanged += final8_ScoreChanged;
            final_8_04.ScoreChanged += final8_ScoreChanged;
            final_8_05.ScoreChanged += final8_ScoreChanged;
            final_8_06.ScoreChanged += final8_ScoreChanged;
            final_8_07.ScoreChanged += final8_ScoreChanged;
            final_8_08.ScoreChanged += final8_ScoreChanged;

            return true;
        }
Пример #2
0
        public void ClearPlayoffs()
        {
            this.startround = PlayoffRound.Final_16;
            this.topplayers = null;

            if (final_16_01 != null) final_16_01.ScoreChanged -= final16_ScoreChanged;
            if (final_16_02 != null) final_16_02.ScoreChanged -= final16_ScoreChanged;
            if (final_16_03 != null) final_16_03.ScoreChanged -= final16_ScoreChanged;
            if (final_16_04 != null) final_16_04.ScoreChanged -= final16_ScoreChanged;
            if (final_16_05 != null) final_16_05.ScoreChanged -= final16_ScoreChanged;
            if (final_16_06 != null) final_16_06.ScoreChanged -= final16_ScoreChanged;
            if (final_16_07 != null) final_16_07.ScoreChanged -= final16_ScoreChanged;
            if (final_16_08 != null) final_16_08.ScoreChanged -= final16_ScoreChanged;
            if (final_16_09 != null) final_16_09.ScoreChanged -= final16_ScoreChanged;
            if (final_16_10 != null) final_16_10.ScoreChanged -= final16_ScoreChanged;
            if (final_16_11 != null) final_16_11.ScoreChanged -= final16_ScoreChanged;
            if (final_16_12 != null) final_16_12.ScoreChanged -= final16_ScoreChanged;
            if (final_16_13 != null) final_16_13.ScoreChanged -= final16_ScoreChanged;
            if (final_16_14 != null) final_16_14.ScoreChanged -= final16_ScoreChanged;
            if (final_16_15 != null) final_16_15.ScoreChanged -= final16_ScoreChanged;
            if (final_16_16 != null) final_16_16.ScoreChanged -= final16_ScoreChanged;

            if (final_8_01 != null) final_8_01.ScoreChanged -= final8_ScoreChanged;
            if (final_8_02 != null) final_8_02.ScoreChanged -= final8_ScoreChanged;
            if (final_8_03 != null) final_8_03.ScoreChanged -= final8_ScoreChanged;
            if (final_8_04 != null) final_8_04.ScoreChanged -= final8_ScoreChanged;
            if (final_8_05 != null) final_8_05.ScoreChanged -= final8_ScoreChanged;
            if (final_8_06 != null) final_8_06.ScoreChanged -= final8_ScoreChanged;
            if (final_8_07 != null) final_8_07.ScoreChanged -= final8_ScoreChanged;
            if (final_8_08 != null) final_8_08.ScoreChanged -= final8_ScoreChanged;

            if (final_4_01 != null) final_4_01.ScoreChanged -= final4_ScoreChanged;
            if (final_4_02 != null) final_4_02.ScoreChanged -= final4_ScoreChanged;
            if (final_4_03 != null) final_4_03.ScoreChanged -= final4_ScoreChanged;
            if (final_4_04 != null) final_4_04.ScoreChanged -= final4_ScoreChanged;

            if (final_2_01 != null) final_2_01.ScoreChanged -= final2_ScoreChanged;
            if (final_2_02 != null) final_2_02.ScoreChanged -= final2_ScoreChanged;

            if (final != null) final.ScoreChanged -= final_ScoreChanged;
            if (game3rdplace != null) game3rdplace.ScoreChanged -= final_ScoreChanged;

            final_16_01 = null;
            final_16_02 = null;
            final_16_03 = null;
            final_16_04 = null;
            final_16_05 = null;
            final_16_06 = null;
            final_16_07 = null;
            final_16_08 = null;
            final_16_09 = null;
            final_16_10 = null;
            final_16_11 = null;
            final_16_12 = null;
            final_16_13 = null;
            final_16_14 = null;
            final_16_15 = null;
            final_16_16 = null;

            final_8_01 = null;
            final_8_02 = null;
            final_8_03 = null;
            final_8_04 = null;
            final_8_05 = null;
            final_8_06 = null;
            final_8_07 = null;
            final_8_08 = null;

            final_4_01 = null;
            final_4_02 = null;
            final_4_03 = null;
            final_4_04 = null;

            final_2_01 = null;
            final_2_02 = null;

            final = null;
            game3rdplace = null;

            NotifyPropertyChanged("Final_16_01");
            NotifyPropertyChanged("Final_16_02");
            NotifyPropertyChanged("Final_16_03");
            NotifyPropertyChanged("Final_16_04");
            NotifyPropertyChanged("Final_16_05");
            NotifyPropertyChanged("Final_16_06");
            NotifyPropertyChanged("Final_16_07");
            NotifyPropertyChanged("Final_16_08");
            NotifyPropertyChanged("Final_16_09");
            NotifyPropertyChanged("Final_16_10");
            NotifyPropertyChanged("Final_16_11");
            NotifyPropertyChanged("Final_16_12");
            NotifyPropertyChanged("Final_16_13");
            NotifyPropertyChanged("Final_16_14");
            NotifyPropertyChanged("Final_16_15");
            NotifyPropertyChanged("Final_16_16");

            NotifyPropertyChanged("Final_8_01");
            NotifyPropertyChanged("Final_8_02");
            NotifyPropertyChanged("Final_8_03");
            NotifyPropertyChanged("Final_8_04");
            NotifyPropertyChanged("Final_8_05");
            NotifyPropertyChanged("Final_8_06");
            NotifyPropertyChanged("Final_8_07");
            NotifyPropertyChanged("Final_8_08");

            NotifyPropertyChanged("Final_4_01");
            NotifyPropertyChanged("Final_4_02");
            NotifyPropertyChanged("Final_4_03");
            NotifyPropertyChanged("Final_4_04");

            NotifyPropertyChanged("Final_2_01");
            NotifyPropertyChanged("Final_2_02");

            NotifyPropertyChanged("Final");
            NotifyPropertyChanged("Game3rdPlace");

            NotifyPropertyChanged("StartRound");
        }
Пример #3
0
        public bool StartPlayoffs16(IEnumerable<Player> players)
        {
            this.ClearPlayoffs();

            StartRound = PlayoffRound.Final_16;

            topplayers = players.Where(p => p.Active == true).OrderBy(p => p.Place).ToList();

            if (topplayers.Count() < 32) return false;

            topplayers = topplayers.Take(32);

            Player player01 = topplayers.ElementAt(0);
            Player player02 = topplayers.ElementAt(1);
            Player player03 = topplayers.ElementAt(2);
            Player player04 = topplayers.ElementAt(3);
            Player player05 = topplayers.ElementAt(4);
            Player player06 = topplayers.ElementAt(5);
            Player player07 = topplayers.ElementAt(6);
            Player player08 = topplayers.ElementAt(7);
            Player player09 = topplayers.ElementAt(8);
            Player player10 = topplayers.ElementAt(9);
            Player player11 = topplayers.ElementAt(10);
            Player player12 = topplayers.ElementAt(11);
            Player player13 = topplayers.ElementAt(12);
            Player player14 = topplayers.ElementAt(13);
            Player player15 = topplayers.ElementAt(14);
            Player player16 = topplayers.ElementAt(15);
            Player player17 = topplayers.ElementAt(16);
            Player player18 = topplayers.ElementAt(17);
            Player player19 = topplayers.ElementAt(18);
            Player player20 = topplayers.ElementAt(19);
            Player player21 = topplayers.ElementAt(20);
            Player player22 = topplayers.ElementAt(21);
            Player player23 = topplayers.ElementAt(22);
            Player player24 = topplayers.ElementAt(23);
            Player player25 = topplayers.ElementAt(24);
            Player player26 = topplayers.ElementAt(25);
            Player player27 = topplayers.ElementAt(26);
            Player player28 = topplayers.ElementAt(27);
            Player player29 = topplayers.ElementAt(28);
            Player player30 = topplayers.ElementAt(29);
            Player player31 = topplayers.ElementAt(30);
            Player player32 = topplayers.ElementAt(31);

            Final_16_01 = new Game()
            {
                Player1Alias = player01.Alias,
                Player1Id = player01.Id,
                Player1RaceCorpo = player01.RaceCorpo,
                Player1RaceRunner = player01.RaceRunner,

                Player2Alias = player32.Alias,
                Player2Id = player32.Id,
                Player2RaceCorpo = player32.RaceCorpo,
                Player2RaceRunner = player32.RaceRunner,
            };

            Final_16_02 = new Game()
            {
                Player1Alias = player16.Alias,
                Player1Id = player16.Id,
                Player1RaceCorpo = player16.RaceCorpo,
                Player1RaceRunner = player16.RaceRunner,

                Player2Alias = player17.Alias,
                Player2Id = player17.Id,
                Player2RaceCorpo = player17.RaceCorpo,
                Player2RaceRunner = player17.RaceRunner,
            };

            Final_16_03 = new Game()
            {
                Player1Alias = player08.Alias,
                Player1Id = player08.Id,
                Player1RaceCorpo = player08.RaceCorpo,
                Player1RaceRunner = player08.RaceRunner,

                Player2Alias = player25.Alias,
                Player2Id = player25.Id,
                Player2RaceCorpo = player25.RaceCorpo,
                Player2RaceRunner = player25.RaceRunner,
            };

            Final_16_04 = new Game()
            {
                Player1Alias = player09.Alias,
                Player1Id = player09.Id,
                Player1RaceCorpo = player09.RaceCorpo,
                Player1RaceRunner = player09.RaceRunner,

                Player2Alias = player24.Alias,
                Player2Id = player24.Id,
                Player2RaceCorpo = player24.RaceCorpo,
                Player2RaceRunner = player24.RaceRunner,
            };

            Final_16_05 = new Game()
            {
                Player1Alias = player04.Alias,
                Player1Id = player04.Id,
                Player1RaceCorpo = player04.RaceCorpo,
                Player1RaceRunner = player04.RaceRunner,

                Player2Alias = player29.Alias,
                Player2Id = player29.Id,
                Player2RaceCorpo = player29.RaceCorpo,
                Player2RaceRunner = player29.RaceRunner,
            };

            Final_16_06 = new Game()
            {
                Player1Alias = player13.Alias,
                Player1Id = player13.Id,
                Player1RaceCorpo = player13.RaceCorpo,
                Player1RaceRunner = player13.RaceRunner,

                Player2Alias = player20.Alias,
                Player2Id = player20.Id,
                Player2RaceCorpo = player20.RaceCorpo,
                Player2RaceRunner = player20.RaceRunner,
            };

            Final_16_07 = new Game()
            {
                Player1Alias = player05.Alias,
                Player1Id = player05.Id,
                Player1RaceCorpo = player05.RaceCorpo,
                Player1RaceRunner = player05.RaceRunner,

                Player2Alias = player28.Alias,
                Player2Id = player28.Id,
                Player2RaceCorpo = player28.RaceCorpo,
                Player2RaceRunner = player28.RaceRunner,
            };

            Final_16_08 = new Game()
            {
                Player1Alias = player12.Alias,
                Player1Id = player12.Id,
                Player1RaceCorpo = player12.RaceCorpo,
                Player1RaceRunner = player12.RaceRunner,

                Player2Alias = player21.Alias,
                Player2Id = player21.Id,
                Player2RaceCorpo = player21.RaceCorpo,
                Player2RaceRunner = player21.RaceRunner,
            };

            Final_16_09 = new Game()
            {
                Player1Alias = player02.Alias,
                Player1Id = player02.Id,
                Player1RaceCorpo = player02.RaceCorpo,
                Player1RaceRunner = player02.RaceRunner,

                Player2Alias = player31.Alias,
                Player2Id = player31.Id,
                Player2RaceCorpo = player31.RaceCorpo,
                Player2RaceRunner = player31.RaceRunner,
            };

            Final_16_10 = new Game()
            {
                Player1Alias = player15.Alias,
                Player1Id = player15.Id,
                Player1RaceCorpo = player15.RaceCorpo,
                Player1RaceRunner = player15.RaceRunner,

                Player2Alias = player18.Alias,
                Player2Id = player18.Id,
                Player2RaceCorpo = player18.RaceCorpo,
                Player2RaceRunner = player18.RaceRunner,
            };

            Final_16_11 = new Game()
            {
                Player1Alias = player07.Alias,
                Player1Id = player07.Id,
                Player1RaceCorpo = player07.RaceCorpo,
                Player1RaceRunner = player07.RaceRunner,

                Player2Alias = player26.Alias,
                Player2Id = player26.Id,
                Player2RaceCorpo = player26.RaceCorpo,
                Player2RaceRunner = player26.RaceRunner,
            };

            Final_16_12 = new Game()
            {
                Player1Alias = player10.Alias,
                Player1Id = player10.Id,
                Player1RaceCorpo = player10.RaceCorpo,
                Player1RaceRunner = player10.RaceRunner,

                Player2Alias = player23.Alias,
                Player2Id = player23.Id,
                Player2RaceCorpo = player23.RaceCorpo,
                Player2RaceRunner = player23.RaceRunner,
            };

            Final_16_13 = new Game()
            {
                Player1Alias = player03.Alias,
                Player1Id = player03.Id,
                Player1RaceCorpo = player03.RaceCorpo,
                Player1RaceRunner = player03.RaceRunner,

                Player2Alias = player30.Alias,
                Player2Id = player30.Id,
                Player2RaceCorpo = player30.RaceCorpo,
                Player2RaceRunner = player30.RaceRunner,
            };

            Final_16_14 = new Game()
            {
                Player1Alias = player14.Alias,
                Player1Id = player14.Id,
                Player1RaceCorpo = player14.RaceCorpo,
                Player1RaceRunner = player14.RaceRunner,

                Player2Alias = player19.Alias,
                Player2Id = player19.Id,
                Player2RaceCorpo = player19.RaceCorpo,
                Player2RaceRunner = player19.RaceRunner,
            };

            Final_16_15 = new Game()
            {
                Player1Alias = player06.Alias,
                Player1Id = player06.Id,
                Player1RaceCorpo = player06.RaceCorpo,
                Player1RaceRunner = player06.RaceRunner,

                Player2Alias = player27.Alias,
                Player2Id = player27.Id,
                Player2RaceCorpo = player27.RaceCorpo,
                Player2RaceRunner = player27.RaceRunner,
            };

            Final_16_16 = new Game()
            {
                Player1Alias = player11.Alias,
                Player1Id = player11.Id,
                Player1RaceCorpo = player11.RaceCorpo,
                Player1RaceRunner = player11.RaceRunner,

                Player2Alias = player22.Alias,
                Player2Id = player22.Id,
                Player2RaceCorpo = player22.RaceCorpo,
                Player2RaceRunner = player22.RaceRunner,
            };

            final_16_01.DiceSystemTop(topplayers);
            final_16_02.DiceSystemTop(topplayers);
            final_16_03.DiceSystemTop(topplayers);
            final_16_04.DiceSystemTop(topplayers);
            final_16_05.DiceSystemTop(topplayers);
            final_16_06.DiceSystemTop(topplayers);
            final_16_07.DiceSystemTop(topplayers);
            final_16_08.DiceSystemTop(topplayers);
            final_16_09.DiceSystemTop(topplayers);
            final_16_10.DiceSystemTop(topplayers);
            final_16_11.DiceSystemTop(topplayers);
            final_16_12.DiceSystemTop(topplayers);
            final_16_13.DiceSystemTop(topplayers);
            final_16_14.DiceSystemTop(topplayers);
            final_16_15.DiceSystemTop(topplayers);
            final_16_16.DiceSystemTop(topplayers);


            final_16_01.ScoreChanged += final16_ScoreChanged;
            final_16_02.ScoreChanged += final16_ScoreChanged;
            final_16_03.ScoreChanged += final16_ScoreChanged;
            final_16_04.ScoreChanged += final16_ScoreChanged;
            final_16_05.ScoreChanged += final16_ScoreChanged;
            final_16_06.ScoreChanged += final16_ScoreChanged;
            final_16_07.ScoreChanged += final16_ScoreChanged;
            final_16_08.ScoreChanged += final16_ScoreChanged;
            final_16_09.ScoreChanged += final16_ScoreChanged;
            final_16_10.ScoreChanged += final16_ScoreChanged;
            final_16_11.ScoreChanged += final16_ScoreChanged;
            final_16_12.ScoreChanged += final16_ScoreChanged;
            final_16_13.ScoreChanged += final16_ScoreChanged;
            final_16_14.ScoreChanged += final16_ScoreChanged;
            final_16_15.ScoreChanged += final16_ScoreChanged;
            final_16_16.ScoreChanged += final16_ScoreChanged;

            return true;
        }
Пример #4
0
        public bool StartPlayoffsFinal(IEnumerable<Player> players)
        {
            this.ClearPlayoffs();
            StartRound = PlayoffRound.Final;

            topplayers = players.Where(p => p.Active == true).OrderBy(p => p.Place).ToList();

            if (topplayers.Count() < 4) return false;

            topplayers = topplayers.Take(4);

            Player player01 = topplayers.ElementAt(0);
            Player player02 = topplayers.ElementAt(1);
            Player player03 = topplayers.ElementAt(2);
            Player player04 = topplayers.ElementAt(3);

            Final = new Game()
            {
                Player1Alias = player01.Alias,
                Player1Id = player01.Id,
                Player1RaceCorpo = player01.RaceCorpo,
                Player1RaceRunner = player01.RaceRunner,

                Player2Alias = player02.Alias,
                Player2Id = player02.Id,
                Player2RaceCorpo = player02.RaceCorpo,
                Player2RaceRunner = player02.RaceRunner,
            };

            Game3rdPlace = new Game()
            {
                Player1Alias = player03.Alias,
                Player1Id = player03.Id,
                Player1RaceCorpo = player03.RaceCorpo,
                Player1RaceRunner = player03.RaceRunner,

                Player2Alias = player04.Alias,
                Player2Id = player04.Id,
                Player2RaceCorpo = player04.RaceCorpo,
                Player2RaceRunner = player04.RaceRunner,
            };

            final.DiceSystemTop(topplayers);
            game3rdplace.DiceSystemTop(topplayers);

            final.ScoreChanged += final_ScoreChanged;
            game3rdplace.ScoreChanged += final_ScoreChanged;

            return true;
        }
Пример #5
0
        public bool StartPlayoffs4(IEnumerable<Player> players)
        {
            this.ClearPlayoffs();

            StartRound = PlayoffRound.Final_4;

            topplayers = players.Where(p => p.Active == true).OrderBy(p => p.Place).ToList();

            if (topplayers.Count() < 8) return false;

            topplayers = topplayers.Take(8);

            Player player01 = topplayers.ElementAt(0);
            Player player02 = topplayers.ElementAt(1);
            Player player03 = topplayers.ElementAt(2);
            Player player04 = topplayers.ElementAt(3);
            Player player05 = topplayers.ElementAt(4);
            Player player06 = topplayers.ElementAt(5);
            Player player07 = topplayers.ElementAt(6);
            Player player08 = topplayers.ElementAt(7);

            Final_4_01 = new Game()
            {
                Player1Alias = player01.Alias,
                Player1Id = player01.Id,
                Player1RaceCorpo = player01.RaceCorpo,
                Player1RaceRunner = player01.RaceRunner,

                Player2Alias = player08.Alias,
                Player2Id = player08.Id,
                Player2RaceCorpo = player08.RaceCorpo,
                Player2RaceRunner = player08.RaceRunner,
            };

            Final_4_02 = new Game()
            {
                Player1Alias = player04.Alias,
                Player1Id = player04.Id,
                Player1RaceCorpo = player04.RaceCorpo,
                Player1RaceRunner = player04.RaceRunner,

                Player2Alias = player05.Alias,
                Player2Id = player05.Id,
                Player2RaceCorpo = player05.RaceCorpo,
                Player2RaceRunner = player05.RaceRunner,
            };

            Final_4_03 = new Game()
            {
                Player1Alias = player02.Alias,
                Player1Id = player02.Id,
                Player1RaceCorpo = player02.RaceCorpo,
                Player1RaceRunner = player02.RaceRunner,

                Player2Alias = player07.Alias,
                Player2Id = player07.Id,
                Player2RaceCorpo = player07.RaceCorpo,
                Player2RaceRunner = player07.RaceRunner,
            };

            Final_4_04 = new Game()
            {
                Player1Alias = player03.Alias,
                Player1Id = player03.Id,
                Player1RaceCorpo = player03.RaceCorpo,
                Player1RaceRunner = player03.RaceRunner,

                Player2Alias = player06.Alias,
                Player2Id = player06.Id,
                Player2RaceCorpo = player06.RaceCorpo,
                Player2RaceRunner = player06.RaceRunner,
            };

            final_4_01.DiceSystemTop(topplayers);
            final_4_02.DiceSystemTop(topplayers);
            final_4_03.DiceSystemTop(topplayers);
            final_4_04.DiceSystemTop(topplayers);

            final_4_01.ScoreChanged += final4_ScoreChanged;
            final_4_02.ScoreChanged += final4_ScoreChanged;
            final_4_03.ScoreChanged += final4_ScoreChanged;
            final_4_04.ScoreChanged += final4_ScoreChanged;

            return true;
        }
        private static IDocumentPaginatorSource RenderFlowDocumentTemplate(Playoffs playoffs, PlayoffRound round)
        {
            string rawXamlText = GetPlayoffsTableXamlString(playoffs, round);

            //Use the XAML reader to create a FlowDocument from the XAML string.
            FlowDocument document = XamlReader.Load(new XmlTextReader(new StringReader(rawXamlText))) as FlowDocument;
            return document;
        }
 public static void PrintPlayoffs(Playoffs playoffs, PlayoffRound round)
 {
     if (playoffs == null) return;
     IDocumentPaginatorSource flowDocument = XamlTemplatePrinter.RenderFlowDocumentTemplate(playoffs, round);
     PrintDocument(flowDocument);
 }
        private static string GetPlayoffsTableXamlString(Playoffs playoffs, PlayoffRound round)
        {
            StringBuilder xamlString = new StringBuilder();

            xamlString.AppendLine("<FlowDocument xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\" ");
            xamlString.AppendLine(" ColumnWidth=\"400\" FontSize=\"16\" FontFamily=\"Arial\">");

            //Header
            xamlString.AppendLine("<Paragraph TextAlignment=\"Center\" FontSize=\"16pt\" FontWeight=\"Bold\">");

            string header = string.Empty;
            switch (round)
            {
                case PlayoffRound.Final_16:
                    header = StringTable.MainWindow_1_16;
                    break;
                case PlayoffRound.Final_8:
                    header = StringTable.MainWindow_1_8;
                    break;
                case PlayoffRound.Final_4:
                    header = StringTable.MainWindow_1_4;
                    break;
                case PlayoffRound.Final_2:
                    header = StringTable.MainWindow_1_2;
                    break;
                case PlayoffRound.Final:
                    header = StringTable.MainWindow_Final;
                    break;
                default:
                    break;
            }

            xamlString.Append(header);
            xamlString.AppendLine("</Paragraph>");

            //Tabela gier
            xamlString.AppendLine("<Table CellSpacing=\"10\">");
            xamlString.AppendLine("<Table.Columns><TableColumn Width=\"100\"/><TableColumn Width=\"200\"/><TableColumn Width=\"200\"/></Table.Columns>");
            xamlString.AppendLine("<TableRowGroup>");

            //Header tabeli
            xamlString.AppendLine("<TableRow>");
            xamlString.AppendFormat("<TableCell><Paragraph FontSize=\"16pt\" FontWeight=\"Bold\" TextAlignment=\"Right\">{0}</Paragraph></TableCell>", StringTable.RoundControl_Nr);
            xamlString.AppendLine();
            xamlString.AppendFormat("<TableCell><Paragraph FontSize=\"16pt\" FontWeight=\"Bold\">{0}</Paragraph></TableCell>", StringTable.RoundControl_Gracz1);
            xamlString.AppendLine();
            xamlString.AppendFormat("<TableCell><Paragraph FontSize=\"16pt\" FontWeight=\"Bold\">{0}</Paragraph></TableCell>", StringTable.RoundControl_Gracz2);
            xamlString.AppendLine();
            xamlString.AppendLine("</TableRow>");

            //wiersze tabeli
            int lp = 1;

            switch (round)
            {
                #region 1/16

                case PlayoffRound.Final_16:

                    if (!playoffs.IsFinal16()) break;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_01.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_01.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_02.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_02.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_03.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_03.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_04.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_04.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_05.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_05.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_06.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_06.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_07.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_07.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_08.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_08.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_09.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_09.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_10.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_10.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_11.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_11.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_12.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_12.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_13.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_13.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_14.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_14.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_15.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_15.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_16.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_16.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    break;

                #endregion

                #region 1/8

                case PlayoffRound.Final_8:

                    if (!playoffs.IsFinal8()) break;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_8_01.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_8_01.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_8_02.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_8_02.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_8_03.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_8_03.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_8_04.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_8_04.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_8_05.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_8_05.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_8_06.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_8_06.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_8_07.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_8_07.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_8_08.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_8_08.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    break;

                #endregion

                #region 1/4

                case PlayoffRound.Final_4:

                    if (!playoffs.IsFinal4()) break;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_4_01.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_4_01.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_4_02.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_4_02.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_4_03.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_4_03.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_4_04.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_4_04.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    break;

                #endregion

                #region 1/2

                case PlayoffRound.Final_2:

                    if (!playoffs.IsFinal2()) break;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_2_01.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_2_01.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_2_02.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_2_02.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    break;

                #endregion

                #region Final

                case PlayoffRound.Final:

                    if (playoffs.IsFinal())
                    {
                        xamlString.Append("<TableRow>");
                        xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                        xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final.Player1Alias));
                        xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final.Player2Alias));
                        xamlString.AppendLine("</TableRow>");
                        lp++;
                    }

                    if (playoffs.IsGame3rd())
                    {
                        xamlString.AppendLine("</TableRowGroup>");
                        xamlString.AppendLine("</Table>");

                        xamlString.AppendLine("<Paragraph TextAlignment=\"Center\" FontSize=\"16pt\" FontWeight=\"Bold\"></Paragraph>");
                        xamlString.AppendFormat("<Paragraph TextAlignment=\"Center\" FontSize=\"16pt\" FontWeight=\"Bold\">{0}</Paragraph>", StringTable.MainWindow_GraOTrzecieMiejsce);
                        xamlString.AppendLine();

                        //Tabela finału
                        xamlString.AppendLine("<Table CellSpacing=\"10\">");
                        xamlString.AppendLine("<Table.Columns><TableColumn Width=\"100\"/><TableColumn Width=\"200\"/><TableColumn Width=\"200\"/></Table.Columns>");
                        xamlString.AppendLine("<TableRowGroup>");

                        //Header tabeli
                        xamlString.AppendLine("<TableRow>");
                        xamlString.AppendFormat("<TableCell><Paragraph FontSize=\"16pt\" FontWeight=\"Bold\" TextAlignment=\"Right\">{0}</Paragraph></TableCell>", StringTable.RoundControl_Nr);
                        xamlString.AppendLine();
                        xamlString.AppendFormat("<TableCell><Paragraph FontSize=\"16pt\" FontWeight=\"Bold\">{0}</Paragraph></TableCell>", StringTable.RoundControl_Gracz1);
                        xamlString.AppendLine();
                        xamlString.AppendFormat("<TableCell><Paragraph FontSize=\"16pt\" FontWeight=\"Bold\">{0}</Paragraph></TableCell>", StringTable.RoundControl_Gracz2);
                        xamlString.AppendLine();
                        xamlString.AppendLine("</TableRow>");

                        xamlString.Append("<TableRow>");
                        xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                        xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Game3rdPlace.Player1Alias));
                        xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Game3rdPlace.Player2Alias));
                        xamlString.AppendLine("</TableRow>");
                        lp++;
                    }

                    break;

                #endregion

                default:
                    break;
            }

            xamlString.AppendLine("</TableRowGroup>");
            xamlString.AppendLine("</Table>");

            //koniec dokumentu
            xamlString.AppendLine("</FlowDocument>");

            return xamlString.ToString();
        }