コード例 #1
0
        /// <inheritdoc />
        public override string GetContent(SessionData sessionData)
        {
            var input = new JSInput(HInput.EInputType.text, Name, Value)
            {
                Class = Class, Style = Style, Title = Title
            };

            if (!string.IsNullOrWhiteSpace(Placeholder))
            {
                input.DescriptionTags = "placeholder='" + Placeholder + "' ";
            }

            if (!string.IsNullOrWhiteSpace(ID))
            {
                input.ID = ID;
            }
            else
            {
                input.ID = Hash.GetHash();
            }

            var container = new HContainer()
            {
                ID = ContainerID, Style = "display:none;"
            };

            input.onclick    = JSFunctionCall.DisplayElementByID(container.ID);
            input.onfocus    = input.onclick;
            input.oninput    = input.SetInnerHTMLWithNameValueAsync(JSElement.GetByID(container.ID), "/" + _pageUrl, JSFunctionCall.DisplayElementByID(container.ID));
            input.onfocusout = new JSIf(JSElement.GetByID(input.ID)["value"].IsEqualTo(new JSRawStringValue("")), JSFunctionCall.HideElementByID(container.ID));

            return(input + container);
        }
コード例 #2
0
        /// <summary>
        /// This method retrieves the page for the user
        /// </summary>
        /// <param name="sessionData">the sessionData for the current user</param>
        /// <returns>the response</returns>
        protected override HElement GetElement(SessionData sessionData)
        {
            // Create a new Page outline for the browser.
            var page = new PageBuilder("LamestWebserver Reference"); // <- the title displayed in the browser window.

            // Add the stylesheet to be referenced in the page.
            page.StylesheetLinks.Add("style.css");

            // Create a div-element - a container - with the class "main" (used in css stylesheet).
            var container = new HContainer()
            {
                Class = "main"
            };

            // Add the container to the page
            page.AddElement(container);

            // Add a Headline and a Text to the page.
            container.AddElement(new HHeadline("LamestWebserver Tutorial / Reference"));
            container.AddElement(new HText("This is a guide and a tutorial on LamestWebserver at the same time."
                                           + " The code for every page of this website has a very indepth description on how everything is done."
                                           + " It might be helpful to browse the code while viewing this reference for better understanding."));

            // Add a new container with the class footer to the page, containing an image from the data directory ("/web") and the current filename and version
            page.AddElement(new HContainer
            {
                Class    = "footer",
                Elements =
                {
                    new HImage("lwsfooter.png"),
                    new HText($"{nameof(MainPage)}.cs\nLamestWebserver Reference v{typeof(MainPage).Assembly.GetName().Version}")
                }
            });

            // Return the response.
            return(page);
        }