Esempio n. 1
0
        /// <summary>
        /// Registers abandon, forfait, exclusion and IsStillInCompetition from given poule to given fencer.
        /// Since it is not always given in the poule phase.
        /// </summary>
        /// <param name="poule"></param>
        /// <returns></returns>
        private FRCFencer registerFencerStatusInPouleFromMatch(FRCPoule poule, FRCFencer fencer)
        {
            FRCMatch match;

            for (int i = 0; i < poule.amountOfMatches(); i++)
            {
                match = poule.getNextMatch();

                if (fencer.ID == match.FencerID1)
                {
                    if (match.Fencer1Abandon)
                    {
                        fencer.Abandoned = true;
                        fencer.IsStillInTheCompetition = false;
                    }
                    else if (match.Fencer1Forfait)
                    {
                        fencer.Forfait = true;
                        fencer.IsStillInTheCompetition = false;
                    }
                    else if (match.Fencer1Exclusion)
                    {
                        fencer.Excluded = true;
                        fencer.IsStillInTheCompetition = false;
                    }
                    return(fencer);
                }
                else if (fencer.ID == match.FencerID2)
                {
                    if (match.Fencer2Abandon)
                    {
                        fencer.Abandoned = true;
                        fencer.IsStillInTheCompetition = false;
                    }
                    else if (match.Fencer2Forfait)
                    {
                        fencer.Forfait = true;
                        fencer.IsStillInTheCompetition = false;
                    }
                    else if (match.Fencer2Exclusion)
                    {
                        fencer.Excluded = true;
                        fencer.IsStillInTheCompetition = false;
                    }
                    return(fencer);
                }
            }

            return(fencer);
        }
Esempio n. 2
0
        /// <summary>
        /// Fills a poule protocole with given poule at given coordinates.
        /// </summary>
        /// <param name="graphics"></param>
        /// <param name="font"></param>
        /// <param name="poule"></param>
        /// <param name="x">The x coordinate where a poule is already drawn.</param>
        /// <param name="y">The y coordinate where a poule is already drawn.</param>
        private void fillPouleProtocole(XGraphics graphics, XFont font, FRCPoule poule, double x, double y)
        {
            int       length = poule.amountOfFencers();
            double    fontHeight = font.GetHeight();
            double    pouleRectWidth = POULE_TOTAL_WIDTH / length;
            FRCFencer fencer1, fencer2;
            FRCMatch  match;
            string    res1, res2;
            double    x1, y1, x2, y2;

            y += fontHeight;

            for (int i = 0; i < poule.amountOfMatches(); i++)
            {
                match = poule.getNextMatch();
                assignMatchResult(out res1, out res2, out fencer1, out fencer2, match);

                y1 = y + (fencer1.FencerNumberInPoule - 1) * fontHeight * 1.25;
                y2 = y + (fencer2.FencerNumberInPoule - 1) * fontHeight * 1.25;
                x1 = x + pouleRectWidth * (fencer2.FencerNumberInPoule - 1);
                x2 = x + pouleRectWidth * (fencer1.FencerNumberInPoule - 1);
                if (res1.Length == 1)
                {
                    x1 += pouleRectWidth * 0.3;
                }
                else if (res1.Length == 2)
                {
                    x1 += pouleRectWidth * 0.2;
                }

                if (res2.Length == 1)
                {
                    x2 += pouleRectWidth * 0.3;
                }
                else if (res2.Length == 2)
                {
                    x2 += pouleRectWidth * 0.2;
                }

                graphics.DrawString(res1, font, XBrushes.Black, x1, y1);
                graphics.DrawString(res2, font, XBrushes.Black, x2, y2);
            }
        }