public void BootstrapModalTest()
        {
            var modal = new BootstrapModal(id: "testModal", title: "Test Modal")
            {
                new H1 {
                    "I'm a Modal"
                },
                new P {
                    "Hello World"
                }
            };

            var expected =
                "<div class=\"modal fade\" id=\"testModal\">" +
                "<div class=\"modal-dialog\">" +
                "<div class=\"modal-header\">" +
                "<button class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\"><span aria-hidden=\"true\">&#215;</span></button>" +
                "<h4>Test Modal</h4>" +
                "</div>" +
                "<div class=\"modal-body\">" +
                "<h1>I&#39;m a Modal</h1>" +
                "<p>Hello World</p>" +
                "</div>" +
                "</div>" +
                "</div>";

            Assert.AreEqual(expected, modal.ToHtml());
        }
Exemple #2
0
        public static void StartApplication <T>(bool bootstrap = true) where T : Form
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            bool inited = false;

            if (bootstrap)
            {
                using (var init = new BootstrapModal())
                {
                    Application.Run(init);
                    inited = init.IsInitialized;
                }
            }
            else
            {
                inited = true;
            }

            if (inited)
            {
                NotificationManager = new NotificationManager();
                NotificationManager.InitializeTray();
                Application.Run(Activator.CreateInstance(typeof(T)) as Form);
                NotificationManager.Dispose();
            }
            if (Bootstrap.Instance != null)
            {
                Bootstrap.Instance.Dispose();
            }
        }
Exemple #3
0
        /// <summary>
        /// Process bootstrap modal dialog window.
        /// </summary>
        public static void ProcessBootstrapModal(AppJson appJson)
        {
            appJson.IsBootstrapModal = false;
            BootstrapModal.DivModalBackdropRemove(appJson);
            bool isExist = false;

            foreach (var item in appJson.ComponentListAll().OfType <BootstrapModal>())
            {
                item.ButtonClose?.ComponentMoveLast();
                isExist = true;
            }
            if (isExist)
            {
                appJson.IsBootstrapModal = true;
                BootstrapModal.DivModalBackdropCreate(appJson);
            }
        }
 public IActionResult AddParagraph([ModelBinder(BinderType = typeof(BootstrapModalBinder))] BootstrapModal bootstrapmodal)
 => PartialView("_ParagraphModal", bootstrapmodal);
 public Task <IViewComponentResult> InvokeAsync(BootstrapModal bootstrapModal)
 {
     return(Task.FromResult <IViewComponentResult>(View(bootstrapModal)));
 }
 public MvcHtmlString Modal(BootstrapModal model)
 {
     return(page.Html.Partial("Bootstrap.Modal", model));
 }