예제 #1
0
        private void btnSeedFinish_Click(object sender, EventArgs e)
        {
            if (!fStartCompetition.ShowStartWindow(FCompetitionController))
            {
                return;
            }
            /* Начало изменений */
            SeedingArgs args = SeedingArgs.Empty;

            args.PlayersToSeed = FCompetition.Players;
            args.SeedOrder     = FCompetitionController.GetDrawOrder(args.PlayersToSeed.Count);
            args.SeedType      = Seeding.SeedType.Matches;
            args.AllowRating   = FCompetition.Info.ChangesRating;


            if (FCompetition is Olympic)
            {
                args.SeedType          = Seeding.SeedType.Olympic;
                args.LastPlayerWithBay = 0;
            }
            if (FCompetition is RobinOlympic)
            {
                args.SeedType = Seeding.SeedType.Groups;
                int playersInGroup = FCompetition.Players.Count / (FCompetition as RobinOlympic).GroupCount;
                if (playersInGroup * (FCompetition as RobinOlympic).GroupCount < FCompetition.Players.Count)
                {
                    playersInGroup++;
                }
                args.Param = playersInGroup;
            }

            //if (fGraphicalSeeding.Seed(args) /*конец изменений*/&& fStartCompetition.ShowStartWindow(FCompetitionController))
            if (fGraphicalSeeding.Seed(args))
            {
                if (pnlCompetitionParams != null)
                {
                    pnlCompetitionParams.ReadParameters();
                }
                string error = "";
                if (!FCompetition.CheckCompetitionParams(ref error))
                {
                    if (error != "")
                    {
                        WindowSkin.MessageBox.Show(error, Localizator.Dictionary.GetString("PARAMS_ERROR"));
                    }
                    return;
                }

                LongOpertationExecutor.Execute(SeedPlayers);
                pnlCompetition.OpenCompetition(FCompetition);
                tcMain.SelectedTab       = tpgCompetition;
                FCompetition.Info.Status = CompetitionInfo.CompetitionState.Playing;
                DatabaseManager.CurrentDb.CompetitionInfoSave(FCompetition.Info);
                UpdateButtons();
            }
        }