public override void WriteTo(TextWriter writer, HtmlEncoder encoder)
        {
            Func <IncControlBase <TModel>, bool> isForDefClass = @base => [email protected](HtmlAttribute.Class).With(r => r.Contains("col-"));
            bool isV3orMore = IncodingHtmlHelper.BootstrapVersion == BootstrapOfVersion.v3;
            bool isStatic   = Input.GetType().Name.Contains("IncStaticControl");

            AddClass(isV3orMore ? B.Form_group.ToLocalization() : "control-group");
            if (IncodingHtmlHelper.FormGroupClass != null)
            {
                AddClass(IncodingHtmlHelper.FormGroupClass);
            }

            Label.AddClass(B.Control_label);
            if (isV3orMore && isForDefClass(Label))
            {
                Label.AddClass(IncodingHtmlHelper.Def_Label_CustomClass ?? IncodingHtmlHelper.Def_Label_Class.ToLocalization());
            }

            if (!isV3orMore)
            {
                Control.AddClass("controls");
            }

            if (string.IsNullOrWhiteSpace(Control.GetAttr(HtmlAttribute.Class)))
            {
                Control.AddClass(isV3orMore
                    ? (IncodingHtmlHelper.Def_Control_CustomClass ?? IncodingHtmlHelper.Def_Control_Class.ToLocalization())
                    : isStatic ? string.Empty : "control-group");
            }

            if (isV3orMore && !typeof(TInput).Name.Contains("IncCheckBoxControl"))
            {
                Input.AddClass(isStatic ? B.Form_static_control.ToLocalization() : B.Form_control.ToLocalization());
            }

            var nestedValidationWithControl =
                NestedValidationWithControl ?? IncodingHtmlHelper.IsNestedValidationWithControl ?? false;

            Control.BuildContent = builder =>
            {
                builder.AppendHtml(Input);
                if (nestedValidationWithControl)
                {
                    builder.AppendHtml(Validation);
                }
            };

            TagBuilder div = new TagBuilder(HtmlTag.Div.ToStringLower());

            div.MergeAttributes(GetAttributes(), true);
            div.InnerHtml.AppendHtml(Label);
            div.InnerHtml.AppendHtml(Control);
            if (!nestedValidationWithControl)
            {
                div.InnerHtml.AppendHtml(Validation);
            }
            div.InnerHtml.AppendHtml(HelpBlock);

            div.WriteTo(writer, encoder);
        }
Exemple #2
0
        public RadarPoint(Radar.RadarPointData data)
        {
            _position = data.Position;

            StyleSheet.Load("/items/perks/radar/RadarPoint.scss");

            RadarDisplay.Instance.AddChild(this);

            AddClass("circular");

            _distanceLabel = Add.Label();
            _distanceLabel.AddClass("distance-label");
            _distanceLabel.AddClass("text-shadow");

            Style.BackgroundColor = data.Color;
            Style.BoxShadow       = new ShadowList()
            {
                new Shadow
                {
                    Blur  = BLUR_RADIUS,
                    Color = data.Color
                }
            };
        }
        public override MvcHtmlString ToHtmlString()
        {
            Func <IncControlBase, bool> isForDefClass = @base => [email protected](HtmlAttribute.Class).With(r => r.Contains("col-"));
            bool isV3orMore = IncodingHtmlHelper.BootstrapVersion == BootstrapOfVersion.v3;
            bool isStatic   = Input.GetType().Name.Contains("IncStaticControl");

            AddClass(isV3orMore ? B.Form_group.ToLocalization() : "control-group");

            Label.AddClass(B.Control_label);
            if (isV3orMore && isForDefClass(Label))
            {
                Label.AddClass(IncodingHtmlHelper.Def_Label_Class.ToLocalization());
            }

            if (!isV3orMore)
            {
                Control.AddClass("controls");
            }

            if (string.IsNullOrWhiteSpace(Control.GetAttr(HtmlAttribute.Class)))
            {
                Control.AddClass(isV3orMore
                                         ? IncodingHtmlHelper.Def_Control_Class.ToLocalization()
                                         : isStatic ? string.Empty : "control-group");
            }

            var stringBuilder = new StringBuilder();

            stringBuilder.Append(Label.ToHtmlString());

            if (isV3orMore && !typeof(TInput).Name.Contains("IncCheckBoxControl"))
            {
                Input.AddClass(isStatic ? B.Form_static_control.ToLocalization() : B.Form_control.ToLocalization());
            }
            Control.Content = Input.ToHtmlString();

            stringBuilder.Append(Control.ToHtmlString());
            stringBuilder.Append(Validation.ToHtmlString());
            stringBuilder.Append(HelpBlock.ToHtmlString());

            var controlGroup = IncodingHtmlHelper.CreateTag(HtmlTag.Div, new MvcHtmlString(stringBuilder.ToString()), GetAttributes());

            return(new MvcHtmlString(controlGroup.ToString()));
        }
Exemple #4
0
 public InspectorTarget()
 {
     _infoPanel = this.AddChild <Label>();
     _infoPanel.AddClass("info");
 }