Example #1
0
 public IconBoxBuilder Bordered(BootstrapColor bgColor, OvalDividerType ovalDividerType)
 {
     this.Component.Bordered        = true;
     this.Component.BgColor         = bgColor;
     this.Component.OvalDividerType = ovalDividerType;
     return(this);
 }
Example #2
0
    public void ChangeColor()
    {
        var colors = Enum.GetValues(typeof(BootstrapColor)).Cast <BootstrapColor>().ToList();
        var random = new Random();
        var c      = random.Next(colors.Count);

        Color = colors[c];
    }
 public static string GetValue(BootstrapColor color)
 => color == BootstrapColor.Primary ? nameof(BootstrapColor.Primary).ToLower()
     : color == BootstrapColor.Secondary ? nameof(BootstrapColor.Secondary).ToLower()
     : color == BootstrapColor.Success ? nameof(BootstrapColor.Success).ToLower()
     : color == BootstrapColor.Danger ? nameof(BootstrapColor.Danger).ToLower()
     : color == BootstrapColor.Warning ? nameof(BootstrapColor.Warning).ToLower()
     : color == BootstrapColor.Info ? nameof(BootstrapColor.Info).ToLower()
     : color == BootstrapColor.Light ? nameof(BootstrapColor.Light).ToLower()
     : color == BootstrapColor.Dark ? nameof(BootstrapColor.Dark).ToLower()
     : nameof(BootstrapColor.Link).ToLower();
Example #4
0
 public ShowMessageResult Message(string title, string message, BootstrapColor type = BootstrapColor.primary)
 {
     return(new ShowMessageResult
     {
         ViewData = ViewData,
         TempData = TempData,
         Title = title,
         Content = message,
         Type = type,
     });
 }
Example #5
0
        /// <summary>
        /// Set the badge icon.
        /// </summary>
        /// <param name="that">The menu builder.</param>
        /// <param name="id">The badge name.</param>
        /// <param name="color">The badge color.</param>
        /// <returns>The <typeparamref name="TBuilder"/> to chain the configures.</returns>
        public static TBuilder HasBadge <TBuilder>(this TBuilder that, string id, BootstrapColor color) where TBuilder : IMenuEntryBuilderBase
        {
            if (that.Finalized)
            {
                throw new InvalidOperationException(ModelFinalized);
            }

            if (!that.Metadata.TryGetValue("Badges", out var ee))
            {
                ee = that.Metadata["Badges"] = new List <(string, BootstrapColor)>();
            }
            if (!(ee is List <(string, BootstrapColor)> badges))
            {
                throw new InvalidOperationException(EverConfigured);
            }

            badges.Add((id, color));
            return(that);
        }
 public ShareButtonsBuilder Color(BootstrapColor color)
 {
     this.Component.Color = color;
     return(this);
 }
Example #7
0
 public static string GetColorName(BootstrapColor color)
 {
     return(color.ToString().ToLower());
 }
Example #8
0
 public BadgeBuilder Color(BootstrapColor color)
 {
     this.Component.BSColor = color;
     return(this);
 }
Example #9
0
 public SectionBuilder BgColor(BootstrapColor BgColor)
 {
     this.Component.BgColor     = BgColor;
     this.Component.SectionType = Vertex.Web.Framework.UI.SectionType.Colored;
     return(this);
 }
Example #10
0
 public IconBoxBuilder ContentColor(BootstrapColor contentColor)
 {
     this.Component.ContentColor = contentColor;
     return(this);
 }
Example #11
0
        public AskPostResult AskPost(string title, string message, object?routeValues = null, BootstrapColor type = BootstrapColor.primary)
        {
            string area, controller, action;

            area       = (string)RouteData.Values[nameof(area)];
            controller = (string)RouteData.Values[nameof(controller)];
            action     = (string)RouteData.Values[nameof(action)];
            return(AskPost(title, message, area, controller, action, routeValues, type));
        }
Example #12
0
        public AskPostResult AskPost(string title, string message, string area, string controller, string action, object?routeValues = null, BootstrapColor type = BootstrapColor.primary)
        {
            if (!(routeValues is Dictionary <string, string> rvd))
            {
                if (routeValues == null)
                {
                    rvd = new Dictionary <string, string>();
                }
                else
                {
                    var vtype = routeValues.GetType();
                    if ((!vtype.FullName?.StartsWith("<>f__AnonymousType")) ?? true)
                    {
                        throw new System.ArgumentException(nameof(routeValues));
                    }

                    rvd = vtype.GetProperties().ToDictionary(
                        keySelector: p => p.Name,
                        elementSelector: p => $"{p.GetValue(routeValues)}");
                }
            }

            return(new AskPostResult
            {
                ViewData = ViewData,
                TempData = TempData,
                Title = title,
                Content = message,
                Type = type,
                AreaName = area,
                ControllerName = controller,
                ActionName = action,
                RouteValues = rvd,
            });
        }
Example #13
0
 public AlertBuilder Color(BootstrapColor color)
 {
     this.Component.Color = color;
     return(this);
 }
Example #14
0
File: Box.cs Project: cuongdn/mmisc
 public Box BgColor(BootstrapColor color)
 {
     Class(string.Format("bg-{0}", color.GetEnumDescription()));
     return(this);
 }
Example #15
0
 /// <inheritdoc cref="RegisterProviderOutput.AppendAlert(string, BootstrapColor)"/>
 public new RegisterProviderOutput <TModel> AppendAlert(string content, BootstrapColor color = BootstrapColor.success)
 {
     base.AppendAlert(content, color);
     return(this);
 }
Example #16
0
 public static string ToCssClass(this BootstrapColor color)
 {
     return(color.ToString().ToLower());
 }
Example #17
0
 public PopupBuilder BgColor(BootstrapColor color)
 {
     this.Component.BgColor = color;
     return(this);
 }
Example #18
0
 public IconBoxBuilder Bordered(BootstrapColor bgColor)
 {
     this.Component.Bordered = true;
     this.Component.BgColor  = bgColor;
     return(this);
 }
Example #19
0
        public static MvcHtmlString ProgressBarFor <T>(this HtmlHelper <T> helper, Expression <Func <T, double> > expression, bool showLabel, BootstrapColor color = BootstrapColor.None)
        {
            ModelMetadata metadata = ModelMetadata.FromLambdaExpression(expression, helper.ViewData);

            return(helper.ProgressBarFor(expression, showLabel ? DefaultLabelFormatString : null, color));
        }
Example #20
0
 public IconBoxBuilder TitleColor(BootstrapColor titleColor)
 {
     this.Component.TitleColor = titleColor;
     return(this);
 }
Example #21
0
 public static MvcHtmlString ProgressBar(this HtmlHelper helper, double value, string labelFormatString = null, BootstrapColor color = BootstrapColor.None)
 {
     return(helper.ProgressBar(value, new ProgressBarOptions {
         ShowLabel = !string.IsNullOrEmpty(labelFormatString), LabelFormatString = labelFormatString, Color = color
     }));
 }
Example #22
0
 public IconBoxBuilder IconColor(BootstrapColor iconColor)
 {
     this.Component.IconColor = iconColor;
     return(this);
 }
Example #23
0
 public static MvcHtmlString ProgressBar(this HtmlHelper helper, int value, string labelFormatString = null, BootstrapColor color = BootstrapColor.None)
 {
     return(helper.ProgressBar(value / 100.0, labelFormatString, color));
 }
Example #24
0
 public ProgressBuilder Color(BootstrapColor color)
 {
     this.Component.Color = color;
     return(this);
 }
Example #25
0
 public static MvcHtmlString ProgressBar(this HtmlHelper helper, double value, bool showLabel, BootstrapColor color = BootstrapColor.None)
 {
     return(helper.ProgressBar(value, showLabel ? DefaultLabelFormatString : null, color));
 }
Example #26
0
 public CountupBuilder Color(BootstrapColor color)
 {
     this.Component.AppendCssClass(string.Format("text-{0}", color.ToCssClass()));
     return(this);
 }
Example #27
0
        public static MvcHtmlString ProgressBarFor <T>(this HtmlHelper <T> helper, Expression <Func <T, double> > expression, string labelFormatString = null, BootstrapColor color = BootstrapColor.None)
        {
            ModelMetadata metadata = ModelMetadata.FromLambdaExpression(expression, helper.ViewData);

            return(helper.ProgressBar((double)metadata.Model, labelFormatString, color));
        }
Example #28
0
 public static MvcHtmlString ProgressBarFor <T>(this HtmlHelper <T> helper, Expression <Func <T, int> > expression, bool showLabel, BootstrapColor color = BootstrapColor.None)
 {
     return(helper.ProgressBarFor(expression, showLabel ? DefaultLabelFormatString : null, color));
 }
Example #29
0
 public BreadcrumbBuilder TextColor(BootstrapColor textColor)
 {
     this.Component.AppendCssClass(string.Format("text-{0}", textColor.ToCssClass()));
     return(this);
 }