private void btnFinishGroupRound_Click(object sender, EventArgs e) { if (WindowSkin.MessageBox.Show(Localizator.Dictionary.GetString("ASK_FINISH_GROUP"), Localizator.Dictionary.GetString("FINISH_GROUP_ROUND_MATCHES"), MessageBoxButtons.YesNo) == DialogResult.Yes) { RobinOlympic competition = FCompetition as RobinOlympic; CompetitionPlayerInfo[] player_for_ko = fGroupWinnersSelect.SelectWinners(competition, FPainters.GroupPainters); if (player_for_ko != null) { SeedPlayersForKO(player_for_ko); } else { WindowSkin.MessageBox.Show(Localizator.Dictionary.GetString("PLAYOFF_NOT_FORMED")); } } }
/// <summary> /// Подтверждение списка игроков, проходящих в следующий раунд /// </summary> /// <param name="competition">RobinOlympic Competition</param> /// <returns>Список игроков, прошедших в плей-офф</returns> internal static CompetitionPlayerInfo[] SelectWinners(RobinOlympic competition, GroupPaintersList groups) { fGroupWinnersSelect form = new fGroupWinnersSelect(); form.Painters = groups; form.Competition = competition; int player_in_group = competition.KOPlayerCount / competition.GroupCount; foreach (GroupPainter painter in groups.Values) { for (int i = 0; i < player_in_group && i < painter.Players.Length; i++) { form.CheckedPlayers.Add(painter.Players[i].Id, true); } } form.pictureControl1.BackColor = WindowSkin.Palette.Colors[0]; form.pictureControl1.Picture = form.CreatePicture(); int width = form.Width - form.pictureControl1.Width + form.pictureControl1.Picture.Width + 50; if (width > Screen.PrimaryScreen.Bounds.Width - 100) { width = Screen.PrimaryScreen.Bounds.Width - 100; } int height = form.Height - form.pictureControl1.Height + form.pictureControl1.Picture.Height + 50; if (height > Screen.PrimaryScreen.Bounds.Height - 100) { height = Screen.PrimaryScreen.Bounds.Height - 100; } form.Width = width; form.Height = height; form.lblPlayerCount.Text = String.Format(Localizator.Dictionary.GetString("PERS"), competition.KOPlayerCount); form.lblPlayerCount.Left = form.label1.Left + form.label1.Width + 3; form.grsdDrawing.SetSeedingOrder(SortitionByRating.GetOlympicSortitionOrder(competition.KOPlayerCount), Seeding.SeedType.Olympic, 0); if (form.ShowDialog() == DialogResult.OK) { return(form.SelectedPlayers); } return(null); }
public override void CreateGrid() { GroupPainterSettings.Scale = Convert.ToSingle(ScalePicture); int DIFF = GroupPainterSettings.Scaled(20); FBitmapSize.Height = DIFF; FBitmapSize.Width = 0; RobinOlympic competition = FCompetition as RobinOlympic; int left = 20; int top = DIFF; FPainters.GroupPainters.Clear(); foreach (GroupRobin group in competition.Groups.Values) { if (FPainters.GroupPainters.Count < competition.GroupCount) { GroupPainter painter = new GroupPainter(); painter.Left = left; painter.TopF = top; painter.Players = group.Players.Values.ToArray(); painter.Matches = group.Matches; FPainters.GroupPainters.Add(group.GroupNo, painter); FBitmapSize.Width = Math.Max(FBitmapSize.Width, painter.Left + painter.Size.Width + DIFF); FBitmapSize.Height += painter.Size.Height + DIFF; top += painter.Size.Height + DIFF; } else { Size size; Point location = new Point(FBitmapSize.Width + 30, 0); OlympicPanel.CreateOlympicGrid(group.Matches, FPainters, GroupPainterSettings.Scale, location, out size, AfterMatchEdit); FBitmapSize.Width = Math.Max(FBitmapSize.Width, size.Width); FBitmapSize.Height = Math.Max(FBitmapSize.Height, size.Height); } } }
public RobinOlympicParamsPanel(RobinOlympic aCompetition) : base(aCompetition) { InitializeComponent(); LocalizeComponents(); ReadParameters(); }