コード例 #1
0
 public void RenderControl(BeamConnections.InteractiveBeam beam)
 {
     if (beam.Exists("clickEvent"))
     {
         BeamConnections.Beam b = beam.GetPropertyValue("clickEvent");
         HTMLEvent            e = new HTMLEvent("onclick");
         e.NotificationName = "click";
         e.Raise.Add((sender, a) => { return("alert('ok');"); });
         this.currentObject.Events.Add(e);
     }
 }
コード例 #2
0
        /// <summary>
        /// Render a single row of a table
        /// </summary>
        /// <param name="row">row to render</param>
        public void RenderControl(UXRow row)
        {
            HorizontalZone h = new HorizontalZone();

            RenderCSSProperties(row, h.CSS);
            row.Get("Width", (s, v) =>
            {
                h.Width = Convert.ToUInt32(v.Value);
            });
            row.Get("Height", (s, v) =>
            {
                h.Height = Convert.ToUInt32(v.Value);
            });
            row.Get("Constraint-Width", (x, y) =>
            {
                EnumConstraint c;
                if (Enum.TryParse <EnumConstraint>(y.Value, out c))
                {
                    h.ConstraintWidth = c;
                }
                else
                {
                    h.ConstraintWidth = EnumConstraint.AUTO;
                }
            });
            row.Get("Constraint-Height", (x, y) =>
            {
                EnumConstraint c;
                if (Enum.TryParse <EnumConstraint>(y.Value, out c))
                {
                    h.ConstraintHeight = c;
                }
                else
                {
                    h.ConstraintHeight = EnumConstraint.AUTO;
                }
            });
            h.CountLines = 1;
            this.currentObject.HorizontalZones.Add(h);
            dynamic previousObject   = this.currentObject;
            string  normalBackground = "Transparent";

            row.Get("BackColor", (s, v) => { normalBackground = v.Value; });
            if (row.IsSelectable)
            {
                HTMLEvent ev = new HTMLEvent("onmouseover");
                ev.Raise.Add((o, e) => {
                    return("this.style.backgroundColor = \"" + row.BackgroundSelectable + "\";");
                });
                h.Events.Add(ev);
                ev = new HTMLEvent("onmouseout");
                ev.Raise.Add((o, e) => {
                    return("this.style.backgroundColor = \"" + normalBackground + "\";");
                });
                h.Events.Add(ev);
            }
            if (row.IsClickable)
            {
                HTMLEvent ev = new HTMLEvent("onclick");
                ev.Raise.Add((o, e) =>
                {
                    return("this.style.backgroundColor = \"" + row.BackgroundClickable + "\"; serverSideCall(\"row\",\"" + row.Id + "\");");
                });
                h.Events.Add(ev);
            }
            for (int pos_column = 0; pos_column < row.ColumnCount; ++pos_column)
            {
                this.currentObject = h;
                if (row.Children.ElementAt(pos_column) != null)
                {
                    RenderControl(row.Children.ElementAt(pos_column));
                }
            }
            this.currentObject = previousObject;
        }