コード例 #1
0
        internal static string GetColorNameForContextualTabColor(ContextualColor color)
        {
            switch (color)
            {
            case ContextualColor.DarkBlue:
                return("db");

            case ContextualColor.LightBlue:
                return("lb");

            case ContextualColor.Teal:
                return("tl");

            case ContextualColor.Orange:
                return("or");

            case ContextualColor.Green:
                return("gr");

            case ContextualColor.Magenta:
                return("mg");

            case ContextualColor.Yellow:
                return("yl");

            case ContextualColor.Purple:
                return("pp");

            default:
                return(string.Empty);
            }
        }
 public static MvcHtmlString BootstrapSubmit(
     this System.Web.Mvc.HtmlHelper html,
     string value,
     ContextualColor contextualColor)
 {
     return(MvcHtmlString.Create(
                $"<input class=\"btn btn-{ContextualColors[contextualColor]}\" type=\"submit\" value =\"{value}\"/>"));
 }
コード例 #3
0
 /// <summary>
 /// Creates a new ContextualGroup.
 /// </summary>
 /// <param name="id">The id of the ContextualGroup.  ie. "ctxgrpPictureTools"</param>
 /// <param name="title">The title of the ContextualGroup that will appear above the Tabs that are in that group when the group is made visible.</param>
 /// <param name="color">The color scheme for this ContextualGroup.  This determines both the color of the group title that will appear above the Tabs in that group but also the color of the Tabs themselves.</param>
 public ContextualGroup(string id, string title, ContextualColor color, string command)
 {
     _id       = id;
     _tabCount = 0;
     _title    = title;
     _color    = color;
     _command  = command;
 }
コード例 #4
0
ファイル: contextualgroup.cs プロジェクト: modulexcite/IL2JS
 /// <summary>
 /// Creates a new ContextualGroup.
 /// </summary>
 /// <param name="id">The id of the ContextualGroup.  ie. "ctxgrpPictureTools"</param>
 /// <param name="title">The title of the ContextualGroup that will appear above the Tabs that are in that group when the group is made visible.</param>
 /// <param name="color">The color scheme for this ContextualGroup.  This determines both the color of the group title that will appear above the Tabs in that group but also the color of the Tabs themselves.</param>
 public ContextualGroup(string id, string title, ContextualColor color, string command)
 {
     _id = id;
     _tabCount = 0;
     _title = title;
     _color = color;
     _command = command;
 }
コード例 #5
0
    public void ChangeColor()
    {
        var colors = Enum.GetValues(typeof(ContextualColor)).Cast <ContextualColor>().ToList();
        var random = new Random();
        var c      = random.Next(colors.Count);

        Color = colors[c];
    }
 public static MvcHtmlString BootstrapHorizontalSubmit(
     this System.Web.Mvc.HtmlHelper html,
     string value,
     ContextualColor contextualColor =
     ContextualColor.Default)
 {
     return(MvcHtmlString.Create(
                "<div class=\"form-group\">"
                + "<div class=\"col-md-10 col-md-offset-2\">"
                + $"<input class=\"btn btn-{ContextualColors[contextualColor]}\" type=\"submit\" value=\"{value}\"/>"
                + "</div>"
                + "</div>"));
 }
 public static MvcHtmlString BootstrapActionLinkButton(
     System.Web.Mvc.HtmlHelper html,
     string linkText,
     string actionName,
     string controllerName,
     ContextualColor contextualColor)
 {
     return(html.BootstrapActionLinkButton(
                linkText,
                actionName,
                controllerName,
                null,
                contextualColor));
 }
 public static MvcHtmlString BootstrapActionLinkButton(
     this System.Web.Mvc.HtmlHelper html,
     string actionName,
     object routeValues,
     ContextualColor contextualColor)
 {
     return(html.ActionLink(
                actionName,
                actionName,
                routeValues,
                new
     {
         @class = $"btn btn-{ContextualColors[contextualColor]}"
     }));
 }
 public static MvcHtmlString BootstrapActionLinkButton(
     this System.Web.Mvc.HtmlHelper html,
     string linkText,
     string actionName,
     ContextualColor contextualColor =
     ContextualColor.Default,
     TargetAttribute targetAttribute = TargetAttribute.Self)
 {
     return(html.ActionLink(
                linkText,
                actionName,
                null,
                new
     {
         @class = $"btn btn-{ContextualColors[contextualColor]}"
     }));
 }
 public static MvcHtmlString BootstrapActionLinkButton(
     this System.Web.Mvc.HtmlHelper html,
     string actionName,
     object routeValues,
     ContextualColor contextualColor,
     TargetAttribute targetAttribute)
 {
     return(html.ActionLink(
                actionName,
                actionName,
                routeValues,
                new
     {
         @class = $"btn btn-{ContextualColors[contextualColor]}",
         target = Bootstrap.BootstrapExtensions.TargetAttributes[targetAttribute]
     }));
 }
 public static MvcHtmlString BootstrapActionLinkButton(
     this System.Web.Mvc.HtmlHelper html,
     string linkText,
     string actionName,
     int id,
     ContextualColor contextualColor = ContextualColor.Default)
 {
     return(html.ActionLink(
                linkText,
                actionName,
                new
     {
         id
     },
                new
     {
         @class = $"btn btn-{ContextualColors[contextualColor]}"
     }));
 }
        public static MvcHtmlString BootstrapActionLinkButton(
            this System.Web.Mvc.HtmlHelper html,
            string actionName,
            string controllerName,
            RouteValueDictionary routeValues,
            ContextualColor contextualColor)
        {
            var htmlAttributes = new Dictionary <string, object>
            {
                {
                    "class", $"btn btn-{ContextualColors[contextualColor]}"
                }
            };

            return(html.ActionLink(
                       actionName,
                       actionName,
                       controllerName,
                       routeValues,
                       htmlAttributes));
        }
 /// <summary>
 ///     Creates a Bootstrap-styled button for a Html.ActionLink
 ///     with the specified action name, id parameter, and
 ///     contextual class. The action name is used as the link
 ///     text.
 /// </summary>
 /// <param name="html">The HTML.</param>
 /// <param name="actionName">Name of the action.</param>
 /// <param name="id">The identifier.</param>
 /// <param name="contextualColor">The contextual class.</param>
 /// <returns>MvcHtmlString.</returns>
 /// TODO Edit XML Comment Template for BootstrapActionLinkButton
 public static MvcHtmlString BootstrapActionLinkButton(
     this System.Web.Mvc.HtmlHelper html,
     string actionName,
     int id,
     ContextualColor contextualColor =
     ContextualColor.Default,
     TargetAttribute targetAttribute = TargetAttribute.Self)
 {
     return(html.ActionLink(
                actionName,
                actionName,
                new
     {
         id
     },
                new
     {
         @class = $"btn btn-{ContextualColors[contextualColor]}",
         target = Bootstrap.BootstrapExtensions.TargetAttributes[targetAttribute]
     }));
 }
コード例 #14
0
ファイル: ribbonbuilder.cs プロジェクト: tralivali1234/IL2JS
        private void AddContextualGroup(JSObject data, RibbonBuildContext rbc)
        {
            ContextualColor color             = ContextualColor.None;
            string          contextualGroupId = DataNodeWrapper.GetAttribute(data, DataNodeWrapper.ID);

            // If the contextual tab group has been normalized, then we build the tabs as regular tabs
            bool normalized = !CUIUtility.IsNullOrUndefined(RibbonBuildOptions.NormalizedContextualGroups) &&
                              RibbonBuildOptions.NormalizedContextualGroups.ContainsKey(contextualGroupId) &&
                              RibbonBuildOptions.NormalizedContextualGroups[contextualGroupId];

            // If the contextual group has been normalized, it means that all of its tabs should
            // behave like regular tabs on this page so we do not need to create the contextual
            // group object in this case.
            if (!normalized)
            {
                switch (DataNodeWrapper.GetAttribute(data, DataNodeWrapper.COLOR))
                {
                case DataNodeWrapper.DARKBLUE:
                    color = ContextualColor.DarkBlue;
                    break;

                case DataNodeWrapper.LIGHTBLUE:
                    color = ContextualColor.LightBlue;
                    break;

                case DataNodeWrapper.MAGENTA:
                    color = ContextualColor.Magenta;
                    break;

                case DataNodeWrapper.GREEN:
                    color = ContextualColor.Green;
                    break;

                case DataNodeWrapper.ORANGE:
                    color = ContextualColor.Orange;
                    break;

                case DataNodeWrapper.PURPLE:
                    color = ContextualColor.Purple;
                    break;

                case DataNodeWrapper.TEAL:
                    color = ContextualColor.Teal;
                    break;

                case DataNodeWrapper.YELLOW:
                    color = ContextualColor.Yellow;
                    break;

                default:
                    color = ContextualColor.None;
                    break;
                }

                Ribbon.AddContextualGroup(contextualGroupId,
                                          DataNodeWrapper.GetAttribute(data, DataNodeWrapper.TITLE),
                                          color,
                                          DataNodeWrapper.GetAttribute(data, DataNodeWrapper.COMMAND));
            }

            JSObject[] tabChildren = DataNodeWrapper.GetNodeChildren(data);
            if (!normalized)
            {
                // This array will usually have one or two entries and at the very most three
                // So we are not using an iterator or caching tabChildren.Length etc.
                for (int i = 0; i < tabChildren.Length; i++)
                {
                    // If the initially visible tabId is in a contextual group, then we make that contextual
                    // group initially visible.
                    string tabId = DataNodeWrapper.GetAttribute(tabChildren[i], DataNodeWrapper.ID);
                    if (tabId == rbc.InitialTabId)
                    {
                        if (CUIUtility.IsNullOrUndefined(RibbonBuildOptions.InitiallyVisibleContextualGroups))
                        {
                            RibbonBuildOptions.InitiallyVisibleContextualGroups = new Dictionary <string, bool>();
                        }
                        RibbonBuildOptions.InitiallyVisibleContextualGroups[contextualGroupId] = true;
                        break;
                    }
                }
            }

            AddTabsToRibbon(tabChildren, normalized ? "" : contextualGroupId, rbc);
        }
コード例 #15
0
ファイル: ribbon.cs プロジェクト: modulexcite/IL2JS
        /// <summary>
        /// Adds a ContextualGroup to this ribbon
        /// </summary>
        /// <param name="id">The id of the ContextualGroup.</param>
        /// <param name="title">The Title of the ContextualGroup.</param>
        /// <param name="color">The color of the ContextualGroup.</param>
        public void AddContextualGroup(string id, string title, ContextualColor color, string command)
        {
            ContextualGroup cg = GetContextualGroup(id);
            if (!CUIUtility.IsNullOrUndefined(cg))
            {
                throw new ArgumentException("A contextual group with id: " + id +
                                       " has already been added to this ribbon.");
            }

            cg = new ContextualGroup(id, title, color, command);
            _contextualGroups[id] = cg;
        }
コード例 #16
0
ファイル: ribbon.cs プロジェクト: modulexcite/IL2JS
        // Called by Tab to set the color of the top border of the tab
        internal void SetContextualColor(ContextualColor color)
        {
            string cssColor = ContextualGroup.GetColorNameForContextualTabColor(color);
            if (string.IsNullOrEmpty(cssColor))
            {
                Utility.RemoveCSSClassFromElement(_elmTopBar2, _currentCtxCss);
                _currentCtxCss = null;
            }
            else
            {
                if (_currentCtxCss == null)
                {
                    Utility.RemoveCSSClassFromElement(_elmTopBar2, _currentCtxCss);

                }
                _currentCtxCss = "ms-cui-ct-topBar-" + cssColor;
                Utility.EnsureCSSClassOnElement(_elmTopBar2, _currentCtxCss);
            }
        }
コード例 #17
0
ファイル: contextualgroup.cs プロジェクト: modulexcite/IL2JS
 internal static string GetColorNameForContextualTabColor(ContextualColor color)
 {
     switch (color)
     {
         case ContextualColor.DarkBlue:
             return "db";
         case ContextualColor.LightBlue:
             return "lb";
         case ContextualColor.Teal:
             return "tl";
         case ContextualColor.Orange:
             return "or";
         case ContextualColor.Green:
             return "gr";
         case ContextualColor.Magenta:
             return "mg";
         case ContextualColor.Yellow:
             return "yl";
         case ContextualColor.Purple:
             return "pp";
         default:
             return string.Empty;
     }
 }