Exemplo n.º 1
0
 private int AssignInternalIds(ToolbarButtonClientConfiguration btn, int counter)
 {
     btn.InternalId = counter++;
     foreach (var sbm in btn.Submenu)
     {
         counter = AssignInternalIds(sbm, counter);
     }
     return(counter);
 }
Exemplo n.º 2
0
        /// <summary>
        /// Adds simple HTML button to toolbar
        /// </summary>
        /// <param name="htmlContent">Direct HTML content of button</param>
        /// <returns>Fluent</returns>
        public ToolbarItemBuilder AddSimpleButton(string htmlContent)
        {
            var conf = new ToolbarButtonClientConfiguration()
            {
                HtmlContent = htmlContent
            };

            _buttons.Add(conf);
            return(new ToolbarItemBuilder(conf));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Adds button with nested toolbar (assumed that button is only opening toobar)
        /// </summary>
        /// <param name="htmlContent">Button HTML content</param>
        /// <param name="submenu">Toolbar menu</param>
        /// <returns>Fluent</returns>
        public ToolbarItemBuilder AddMenu(string htmlContent, Action <ToolbarSubmenuBuilder> submenu)
        {
            var conf = new ToolbarButtonClientConfiguration()
            {
                HtmlContent = htmlContent,
                IsMenu      = true,
            };
            var suBuilder = new ToolbarSubmenuBuilder(conf.Submenu);

            submenu(suBuilder);
            _buttons.Add(conf);
            return(new ToolbarItemBuilder(conf));
        }
Exemplo n.º 4
0
        /// <summary>
        /// Adds button invoking specified table command
        /// </summary>
        /// <param name="htmlContent">HTML button content</param>
        /// <param name="command">Command that button initiates</param>
        /// <param name="disableWhileCommand">When true, button will be disabled while command is executing</param>
        /// <param name="callbackFunction">Javascript function containing callback after command execution</param>
        /// <param name="confirmationFunction">Javascript function that is being called before command execution</param>
        /// <returns></returns>
        public ToolbarItemBuilder AddCommandButton(string htmlContent, string command,
                                                   bool disableWhileCommand = true, string callbackFunction = null, string confirmationFunction = null)
        {
            var conf = new ToolbarButtonClientConfiguration()
            {
                HtmlContent          = htmlContent,
                BlackoutWhileCommand = disableWhileCommand,
                Command = command,
                CommandCallbackFunction = callbackFunction != null ? new JRaw(callbackFunction) : null,
                ConfirmationFunction    = confirmationFunction != null? new JRaw(confirmationFunction) : null
            };

            _buttons.Add(conf);
            return(new ToolbarItemBuilder(conf));
        }
Exemplo n.º 5
0
 public ToolbarItemBuilder(ToolbarButtonClientConfiguration configuration)
 {
     _configuration = configuration;
 }