Esempio n. 1
0
        protected override void RenderBegin(RenderingContext context)
        {
            if (string.IsNullOrEmpty(this.content))
            {
                return;
            }

            byte[] buf = context.OutputEncoding.GetBytes(this.content);
            context.OutputStream.Write(buf, 0, buf.Length);
        }
Esempio n. 2
0
        public override sealed void OnRequest(Request request, Response response)
        {
            using (MemoryStream ms = new MemoryStream())
            {
                Document form = this.CreateForm();

                RenderingContext rc = new RenderingContext(ms);
                rc.Request = request;
                rc.Response = response;
                form.Render(rc);

                response.Write(ms.ToArray());
            }
        }
Esempio n. 3
0
        protected override void RenderBegin(RenderingContext context)
        {
            StreamWriter writer = new StreamWriter(context.OutputStream, context.OutputEncoding);

            writer.Write("<span>");

            if (this.ShowTargetHostname)
            {
                if (this.ShowTargetSchema)
                {
                    writer.Write(this.Target.Scheme + "://");
                }
                writer.Write(this.Target.Host);
            }
            string s = "/";

            writer.Write("/ ");
            var segments = (this.ShowTargetHostname) ? this.Target.Segments : this.Target.Segments.Skip(1);
            foreach (string seg in segments)
            {
                s += seg;

                Anchor anchor = new Anchor(new Uri(this.Target.Scheme + "://" + this.Target.Host + s),
                    seg.Trim('/'));
                writer.Flush();
                anchor.Render(context);

                writer.Write(" / ");
            }

            writer.Flush();
        }
Esempio n. 4
0
        protected override void RenderEnd(RenderingContext context)
        {
            StreamWriter writer = new StreamWriter(context.OutputStream, context.OutputEncoding);

            writer.Write("</span>");
            writer.Flush();
        }
Esempio n. 5
0
        /// <summary>
        /// When overridden in a derived class, performs control rendering.
        /// </summary>
        /// <remarks>
        /// This method is invoked after all the children of the current <see cref="Control"/> have completed their rendering.
        /// It should be used to close any open XML or XHTML tags, for example.
        /// </remarks>
        /// <param name="context"></param>
        protected virtual void RenderEnd(RenderingContext context)
        {
            if (!this.CanContainControls)
            {
                return;
            }
            else if (this.Controls.Count > 0)
            {
                StreamWriter writer = new StreamWriter(context.OutputStream, context.OutputEncoding);

                writer.Write("</" + this.Name + ">");
                writer.Flush();
            }
        }
Esempio n. 6
0
        /// <summary>
        /// When overridden in a derived class, performs control rendering.
        /// </summary>
        /// <remarks>
        /// This method is invoked before any children of the current <see cref="Control"/> have started their rendering.
        /// Use it to begin XML or XHTML tags, for example.
        /// </remarks>
        /// <param name="context"></param>
        protected virtual void RenderBegin(RenderingContext context)
        {
            using (StreamWriter writer = new StreamWriter(context.OutputStream, context.OutputEncoding))
            {
                writer.Write("<" + this.Name);

                if (this.CanContainAttributes && this.Attributes.Count > 0)
                {
                    writer.Write(" " + string.Join(" ", (from a in this.Attributes
                                                         where a.Include == true
                                                         select a.Name + "=\"" + a.Value + "\"").ToArray()));
                }

                if (!this.CanContainControls || this.Controls.Count == 0)
                {
                    writer.Write(" />");
                }
                else
                {
                    writer.Write(">");
                }

                writer.Flush();
            }
        }
Esempio n. 7
0
        /// <summary>
        /// Renders the current <see cref="Control"/> against the specified <see cref="RenderingContext"/>.
        /// </summary>
        /// <param name="context"></param>
        public void Render(RenderingContext context)
        {
            this.OnPreRender(context);

            this.RenderBegin(context);
            if (this.CanContainControls)
            {
                foreach (Control c in this.Controls)
                {
                    c.Render(context);
                }
            }
            this.RenderEnd(context);

            this.OnPostRender(context);
        }
Esempio n. 8
0
 /// <summary>
 /// Raises the <see cref="PreRender"/> event.
 /// </summary>
 /// <param name="context"></param>
 public virtual void OnPreRender(RenderingContext context)
 {
     if (this.PreRender != null)
     {
         this.PreRender(this, new RenderEventArgs(context));
     }
 }
Esempio n. 9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RenderEventArgs"/>
 /// class.
 /// </summary>
 /// <param name="context"></param>
 public RenderEventArgs(RenderingContext context)
 {
     this.context = context;
 }
Esempio n. 10
0
 protected override void RenderEnd(RenderingContext context)
 {
 }
Esempio n. 11
0
 protected override void RenderBegin(RenderingContext context)
 {
     base.RenderBegin(context);
 }