Ejemplo n.º 1
0
        private static void InitializeWebUIElement(Form newForm, WebForm mainWebForm)
        {
            //Call the initialized event
            newForm.OnInitialized();
            var halfWidth         = Document.ClientWidth / 2;
            var halfHeight        = Document.ClientHeight / 2;
            var newFormHalfWidth  = newForm.Size.Width / 2;
            var newFormHalfHeight = newForm.Size.Height / 2;

            newForm.Location = new Point(halfWidth - newFormHalfWidth, halfHeight - newFormHalfHeight);
            //Center the form
            newForm.Focus();
            JQuery.FromSelector(".winform").ZIndex(1);
            mainWebForm.InternalJQElement.ZIndex(1000);
            if (newForm.FormBorderStyle == FormBorderStyle.Sizable)
            {
                newForm.UnderlyingWebForm.InternalJQElement.ResizableAnimated();
            }

            mainWebForm.InternalJQElement.AddClass("winform");
            mainWebForm.InternalJQElement.Draggable();

            //Add a close button
            var btnClose = new AnchorElement
            {
                Href        = "#",
                Class       = "close webform-close-btn",
                Style       = "color: #000000;",
                TextContent = "×"
            };

            btnClose.Click += (s, e) => CloseForm(newForm);
            mainWebForm.InternalJQElement.Append(btnClose);
        }
Ejemplo n.º 2
0
        public static void StartApplication(NKApplication app, string targetElementSelector)
        {
            //Verify that we are running on JSIL
            if (Verbatim.Expression("0") == null)
            {
                throw new RequiresJSILRuntimeException();
            }
            //TODO: Initialize DOM host object with jQuery
            var targetElement = new JQElement(JQuery.FromSelector(targetElementSelector).DomElement);

            app.HostElement = targetElement;
            app.Create();
        }