Ejemplo n.º 1
0
        /// <summary>
        /// Renders at runtime.
        /// </summary>
        /// <param name="writer">HtmlTextWriter object.</param>
        protected void RunTimeRender(System.Web.UI.HtmlTextWriter writer)
        {
            if (null == AffiliateId ||
                String.Empty == AffiliateId)
            {
                throw new ApplicationException("No client id has been specified");
            }

            UnitDimensions obDim = GetUnitDimensions();

            writer.Write("<div id=\"{0}\">", this.ClientID);

            writer.Write("<script type=\"text/javascript\">");
            writer.Write(String.Format("google_ad_client=\"{0}\";", this.AffiliateId));
            switch (this.AlternateAdType)
            {
            case AlternateAdTypes.AnotherUrlAds:
                writer.Write(String.Format("google_alternate_ad_url=\"{0}\";", this.AnotherUrl));
                break;

            case AlternateAdTypes.SolidColorFill:
                writer.Write(String.Format("google_alternate_color=\"{0}\";", DrawingUtil.GetColorHexFormat(this.SolidFillColor, true)));
                break;
            }
            writer.Write(String.Format("google_ad_width={0};", obDim.WIDTH));
            writer.Write(String.Format("google_ad_height={0};", obDim.HEIGHT));
            writer.Write(String.Format("google_ad_format=\"{0}\";", this.GetAdFormat()));
            writer.Write(String.Format("google_ad_channel=\"{0}\";", this.ChannelId));
            writer.Write(String.Format("google_color_border=\"{0}\";", DrawingUtil.GetColorHexFormat(this.BorderColor, true)));
            writer.Write(String.Format("google_color_bg=\"{0}\";", DrawingUtil.GetColorHexFormat(this.BackColor, true)));
            writer.Write(String.Format("google_color_link=\"{0}\";", DrawingUtil.GetColorHexFormat(this.LinkColor, true)));
            writer.Write(String.Format("google_color_url=\"{0}\";", DrawingUtil.GetColorHexFormat(this.UrlColor, true)));
            writer.Write(String.Format("google_color_text=\"{0}\";", DrawingUtil.GetColorHexFormat(this.TextColor, true)));

            InsertSpecificScript(writer);

            writer.Write("</script>");
            writer.Write("<script type=\"text/javascript\"");
            writer.Write(" src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\">");
            writer.Write("</script>");

            writer.Write("</div>");
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Helps to design rendering time.
        /// </summary>
        /// <param name="writer"></param>
        override protected void DesignTimeRender(System.Web.UI.HtmlTextWriter writer)
        {
            StringBuilder strStream = new StringBuilder();

            String strFormat = this.LinkUnitFormat.ToString();

            UnitDimensions obDim = AdUnitGlobals.g_LinkUnitDimensions[this.LinkUnitFormat] as UnitDimensions;

            if (strFormat.StartsWith("H"))
            {
                strStream.AppendFormat(AdUnitGlobals.g_strLinkUnitDesigntimeRender_H.ToString(), obDim.WIDTH, obDim.HEIGHT, DrawingUtil.GetColorHexFormat(this.BorderColor, false), DrawingUtil.GetColorHexFormat(this.TextColor, false), DrawingUtil.GetColorHexFormat(this.BackColor, false), "&nbsp;");
            }
            else
            {
                strStream.AppendFormat(AdUnitGlobals.g_strLinkUnitDesigntimeRender_V.ToString(), obDim.WIDTH, obDim.HEIGHT, DrawingUtil.GetColorHexFormat(this.BorderColor, false), DrawingUtil.GetColorHexFormat(this.TextColor, false), DrawingUtil.GetColorHexFormat(this.BackColor, false), "&nbsp;");
            }


            writer.Write(strStream.ToString());
        }
Ejemplo n.º 3
0
        override protected void DesignTimeRender(System.Web.UI.HtmlTextWriter writer)
        {
            StringBuilder strStream = new StringBuilder();

            UnitDimensions obDim = AdUnitGlobals.g_AdUnitDimensions[this.AdUnitFormat] as UnitDimensions;

            strStream.AppendFormat(AdUnitGlobals.g_strAdUnitDesigntimeRender, obDim.WIDTH, obDim.HEIGHT, DrawingUtil.GetColorHexFormat(this.BorderColor, false), DrawingUtil.GetColorHexFormat(this.TextColor, false), DrawingUtil.GetColorHexFormat(this.BackColor, false), "&nbsp;");

            writer.Write(strStream.ToString());
        }