Exemple #1
0
        /// <summary>
        /// Specifies where we're going to draw on top of the template, what we're going to
        /// say and with which fonts, colours, decoration, etc.
        /// </summary>
        protected override void RegisterAreasOfInterest()
        {
            // Setup the position of each asset (if they've not been specified outside the class)
            Area mapCaptionRect = new Area(this.GDI, "#mapCaption", 1715, 1520, 650, 120);
            Position qrCodePosition = new Position(this.GDI,"#qrCode", 1704, 1800);
            Position qRCaptionPosition = new Position(this.GDI,"#qrCaption", 1704, 2000);

            // Add caption on to the polaroid
            Typeface mapCaptionFont = new Typeface("Bradley Hand ITC")
                .Bold(true)
                .Italic(true)
                .FontColour("#000000")
                .FontSize(35)
            ;

            Typeface gameDetailFont = new Typeface()
                .FontColour("#252525")
                .FontSize(50)
            ;
            Typeface gameLinkFont = new Typeface(gameDetailFont)
                .Underline(true)
                .FontColour("#cc0000")
            ;

            Caption mapCaption =
                new Caption(base.GDI, "#mapCaption", this.Venue)
                .Typeface(mapCaptionFont)
                .HorizontalAlignment(StringAlignment.Near)
                .Rect(mapCaptionRect)
            ;

            // Add the Quick Response code
            QRCode qrCode =
                new QRCode(base.GDI, "#qrCode", this.SignUpLink)
                .TopLeft(qrCodePosition)
                .Data(this.SignUpLink)
                .Scale(20)
                .Version(4)
            ;

            // add instructions
            Caption where = new Caption(base.GDI, "#where")
                .Text(this.Venue)
                .Rect(200, 1000, 1400, 300)
                .Typeface(gameDetailFont)
            ;
            Caption when = new Caption(base.GDI, "#when")
                .Text(this.Frequency)
                .Rect(200, 1500, 1400, 300)
                .Typeface(gameDetailFont)
            ;
            Caption howSignUp = new Caption(base.GDI, "#how")
                .Text("Join the game with the QR code, or at the website below:")
                .Rect(200, 2000, 1400, 300)
                .Typeface(gameDetailFont)
            ;
            Caption howLink = new Caption(base.GDI, "#how")
                .Text(this.SignUpLink)
                .Rect(200, 2200, 1400, 300)
                .Typeface(gameLinkFont)
            ;

            List<Position> areas = new List<Position>();

            areas.Add( where );
            areas.Add( when );
            areas.Add( howSignUp );
            areas.Add( howLink );

            areas.Add( this.VenueMap );
            areas.Add( mapCaption );
            areas.Add( qrCode );

            // Now we've defined all our instructions for what to draw, tell the PosterBuilder
            base.AreasOfInterest = areas;
        }
        /// <summary>
        /// Specifies where we're going to draw on top of the template, what we're going to
        /// say and with which fonts, colours, decoration, etc.
        /// </summary>
        protected override void RegisterAreasOfInterest()
        {
            Typeface.DEFAULT_FONT_NAME = "Bradley Hand ITC";
            Typeface.DEFAULT_HEX_COLOUR = "#A56BDB";
            Typeface.DEFAULT_FONT_SIZE = 11;

            // roughly number of years since they started playing
            int years = (int)Math.Ceiling((DateTime.Now - this.Birthday).TotalDays / 365d);

            string birthdayMsg =
                string.Format("On {0} it's your pitch birthday.  You've been playing football with us for {1} years!",
                    this.Birthday.ToString("MMM dd"), years
                );

            Caption hello =
                new Caption(base.GDI, "#hello", "Hi " + this.OfferFor + ",")
                    .TopLeft(5, 65)
                ;

            Caption noticedYourBithday =
                new Caption(base.GDI, "#birthday", birthdayMsg)
                    .Rect(5, 90, 350, 100)
                ;

            Caption offer =
                new Caption(base.GDI, "#offer", this.SpecialOffer)
                    .Rect(5, 135, 350, 100)
                ;

            QRCode qrCode =
                new QRCode(base.GDI, "#qrCode", this.GenerateQRCodeData())
                    .TopLeft(350, 75)
                    .Scale(2)
                    .Version(4)
            ;

            this.AreasOfInterest.Add(hello);
            this.AreasOfInterest.Add(noticedYourBithday);
            this.AreasOfInterest.Add(offer);
            this.AreasOfInterest.Add(qrCode);
        }