Ejemplo n.º 1
0
        /// <summary>
        /// 设置属性
        /// </summary>
        protected override void SetAttributes()
        {
            ProgressBar control = this.ControlHost.Content as ProgressBar;

            this.HtmlWriter.AddAttribute("dojoType", "Controls/ProgressBar");
            if (!IsPreview && !string.IsNullOrEmpty(this.ControlHost.Name))
            {
                this.HtmlWriter.AddAttribute("id", this.ControlHost.Name);
                this.HtmlWriter.AddAttribute("name", this.ControlHost.Name);
            }
            if (!string.IsNullOrEmpty(control.ToolTip) && this.ProjectDocument != null)
            {
                this.HtmlWriter.AddAttribute("tooltip-name", this.ProjectDocument.Name + "_" + control.ToolTip);
            }
            if (!string.IsNullOrEmpty(control.Label))
            {
                this.HtmlWriter.AddAttribute("label", control.Label);
            }

            StringBuilder sbProps       = new StringBuilder();
            StringBuilder returnContent = new StringBuilder();
            string        props         = control.BuildControlProps(this.ScreenDefinition, this.IsPreview, this.PermissionData, returnContent);

            if (!string.IsNullOrEmpty(props))
            {
                sbProps.AppendFormat("{0},", props);
            }
            sbProps.AppendFormat("indeterminate:{0},", control.ShowProgress.ToString().ToLower());
            sbProps.AppendFormat("maximum:100,");
            sbProps.AppendFormat("places:1,");

            if (sbProps.ToString().Length > 0)
            {
                this.HtmlWriter.AddAttribute("data-dojo-props", sbProps.ToString().Substring(0, sbProps.ToString().Length - 1), false);
            }

            base.SetAttributes();
        }