public Box Style(BootstrapStyle style) { BootstrapStyle = style; if (style != BootstrapStyle.None) { Class(string.Format("box-{0}", style.GetEnumDescription())); } return(this); }
public void FromXml(XElement elem) { Name = elem.Attribute("Name") !.Value; Style = elem.Attribute("Style") !.Value.ToEnum <BootstrapStyle>(); }
public static void WriteLine(string format = "", BootstrapType type = BootstrapType.Default, BootstrapStyle style = BootstrapStyle.Text, bool fillLineBackground = false) { ConsoleWriter(format, type, style, fillLineBackground); Console.WriteLine(); }
internal static BootstrapType ConsoleWriter(string format, BootstrapType type, BootstrapStyle style, bool fillLineBackground) { Customize.SetBufferAppearance(BootstrapTheme, type, style, fillLineBackground); char[] chars = format.ToCharArray(); lock (Threads) { Console.Write(chars); Console.ResetColor(); } return(type); }
internal new static BootstrapType ConsoleWriter(string format, BootstrapType type, BootstrapStyle style, bool fillLineBackground) { Customize.SetBufferAppearance(BootstrapTheme, type, style, fillLineBackground); char[] chars = format.ToCharArray(); lock (Threads) { for (int i = 0; i < chars.Length; i++) { Console.Write(chars[i]); Thread.Sleep(_random.Next(_minDelay, _maxDelay)); } Console.ResetColor(); } return(type); }
public override void Process(TagHelperContext context, TagHelperOutput output) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (output == null) { throw new ArgumentNullException(nameof(output)); } base.Process(context, output); var href = ""; if (Path.Trim().Length > 0) { // Assemble the value for the href parameter if (Path.StartsWith('/')) { href = $@"href='{Path.Trim()}'"; } else { href = $@"href='/{Path.Trim()}'"; } var ids = context.AllAttributes.Where(attribute => attribute.Name.StartsWith("id")); // Generate Id parameters var param = ""; foreach (var id in ids) { var name = id.Name; if (name.Contains("-")) { name = name.Substring(name.IndexOf('-') + 1); } param += $"&{name}={id.Value}"; } if (param.StartsWith("&")) { param = param.Substring(1); } if (param.Length > 0) { href = href.Insert(href.Length - 1, $"?{param}"); } // Display Glyph icons var glyphClasses = string.Empty; Glyph = Glyph.Trim(); if (Glyph.StartsWith("glyphicon-")) { Glyph = Glyph.Substring(Glyph.IndexOf('-') + 1); } if (Glyph.Length > 0) { glyphClasses = $"class='glyphicon glyphicon-{Glyph}'"; if (Description.Length > 0) { Description = $" {Description}"; } } // Bootstrap Buttons BootstrapStyle = BootstrapStyle.Trim(); if (!BootstrapStyle.StartsWith("btn-")) { BootstrapStyle = $"btn-{BootstrapStyle}"; } BootstrapSize = BootstrapSize.Trim(); if (!BootstrapSize.StartsWith("btn-")) { BootstrapSize = $"btn-{BootstrapSize}"; } var BootstrapClass = string.Empty; if (BootstrapStyle.Length > 4 && BootstrapSize.Length > 4) { BootstrapClass = $"class='{BootstrapSize} {BootstrapStyle}'"; } output.Content.AppendHtml( $"<a style='min-width:30px;display:inline-block;' {BootstrapClass} {href}><span {glyphClasses}></span>{Description}</a>"); } }
internal static void SetBufferAppearance(BootstrapTheme theme, BootstrapType type, BootstrapStyle style, bool fillLineBackground) { lock (Bootstrap.Threads) { string descTheme = EnumExtension.GetDescription(theme); string descType = EnumExtension.GetDescription(type); string fgColor = (theme != BootstrapTheme.LigthColor ? descType : $"Dark{descType}"); string bgColor = (theme != BootstrapTheme.LigthColor ? $"Dark{descType}" : descType); if (style == BootstrapStyle.Text) { fgColor = (theme != BootstrapTheme.LigthColor ? $"Dark{descType}" : descType); } Console.ForegroundColor = (ConsoleColor)Enum.Parse(typeof(ConsoleColor), fgColor, true); Console.BackgroundColor = (ConsoleColor)Enum.Parse(typeof(ConsoleColor), (style != BootstrapStyle.Text ? bgColor : "Black"), true); } FillLineBackground(fillLineBackground); }