Exemplo n.º 1
0
        public static Element[] CreateDateTimeField()
        {
            var label = new LabelElement
            {
                HtmlFor   = "dateTimeInput",
                InnerHTML = "Server Date and Time:"
            };

            var div = new DivElement
            {
                ClassName = "input-group"
            };

            var spanPrefix = new SpanElement
            {
                ClassName = "input-group-addon glyphicon glyphicon-time"
            };

            var spanSuffix = new SpanElement
            {
                ClassName = "input-group-btn"
            };

            var button = new ButtonElement
            {
                Type      = ButtonType.Button,
                ClassName = "btn btn-primary",
                InnerHTML = "<span class=\"glyphicon glyphicon-refresh\"></span>",
                OnClick   = Html5App.UpdateButton_Click
            };

            var input = new InputElement
            {
                Id          = "dateTimeInput",
                Type        = InputType.Text,
                ClassName   = "form-control",
                Placeholder = "Click update...",
                ReadOnly    = true,
                Name        = "datetime"
            };

            spanSuffix.AppendChild(button);

            div.AppendChild(spanPrefix);
            div.AppendChild(input);
            div.AppendChild(spanSuffix);

            return(new Element[] { label, div });
        }
Exemplo n.º 2
0
        public void LogMessage(string message, bool newLine = true)
        {
            if (message == null)
            {
                message = "";
            }

            message = GetSecureTag() + message;

            var createdNew = false;
            if (LastLogMessage == null || newLine)
            {
                LastLogMessage = Document.CreateElement<PreElement>("p");
                LastLogMessage.Style.WordWrap = WordWrap.Normal;
                LastLogMessage.Style.Margin = "5px";
                createdNew = true;
            }

            if (createdNew)
            {
                LastLogMessage.InnerHTML = message;
                ConsoleLog.AppendChild(LastLogMessage);
            }
            else
            {
                LastLogMessage.InnerHTML += message;
            }

            ConsoleLog.ScrollTop = ConsoleLog.ScrollHeight;
        }
Exemplo n.º 3
0
        public static DivElement CreatePanel()
        {
            var panel = new DivElement
            {
                ClassName = "panel panel-default"
            };

            var header = Html5App.CreatePanelHeader();
            var body   = Html5App.CreatePanelBody();
            var footer = Html5App.CreatePanelFooter();

            panel.AppendChild(header);
            panel.AppendChild(body);
            panel.AppendChild(footer);

            return(panel);
        }
Exemplo n.º 4
0
        public static DivElement CreateFormField(string name, string glyph)
        {
            var div = new DivElement
            {
                ClassName = "input-group",
                Style     =
                {
                    MarginBottom = "10px"
                }
            };

            var span = new SpanElement
            {
                ClassName = "glyphicon glyphicon-" + glyph + " input-group-addon"
            };

            Element input;
            var     placeholder = name + "...";

            if (name == "Message")
            {
                input = new TextAreaElement
                {
                    Name        = name.ToLowerCase(),
                    Placeholder = placeholder,
                    Required    = true,
                    ClassName   = "form-control"
                };
            }
            else
            {
                input = new InputElement
                {
                    Type        = InputType.Text,
                    Name        = name.ToLowerCase(),
                    Placeholder = placeholder,
                    Required    = true,
                    ClassName   = "form-control"
                };
            }

            div.AppendChild(span);
            div.AppendChild(input);

            return(div);
        }
Exemplo n.º 5
0
        public ILayout CreateLayout(int width, int height)
        {
            var xnaLayout = new WebLayout(this, width, height);

            WebLayouts.Add(xnaLayout);
            Element.AppendChild(xnaLayout.Element);
            return(xnaLayout);
        }
Exemplo n.º 6
0
        public static Element GetRepeatRegion()
        {
            var itemsSpan = new SpanElement();

            itemsSpan.InnerHTML = "Checkpoint";
            var itemsPara = new ParagraphElement();

            itemsPara.InnerHTML = "{{checkpoint.callsign}}[{{checkpoint.id}}]";

            var itemsLI = new LIElement();

            itemsLI.SetNGRepeat("checkpoint", "checkpoints");
            itemsLI.AppendChild(itemsSpan);
            itemsLI.AppendChild(itemsPara);

            var itemsUL = new UListElement();

            itemsUL.AppendChild(itemsLI);

            var itemsSubSpan = new SpanElement()
            {
                InnerHTML = "[{{checkpoint.callsign}}.{{checkpoint.id}}] "
            };

            var itemsSearchBox = new InputElement();

            itemsSearchBox.SetNGModel("cpFilter");

            var itemsOrderSelector = GetOrderBySelector("cpOrderBy");

            itemsSubSpan.SetNGRepeat("checkpoint", "checkpoints",
                                     itemsSearchBox.GetNGModel(), itemsOrderSelector.GetNGModel());

            var itemsDiv = new DivElement();

            itemsDiv.SetNGController("hwbSctl");
            itemsDiv.AppendChild(itemsUL);
            itemsDiv.AppendChild(itemsSearchBox);
            itemsDiv.AppendChild(itemsOrderSelector);
            itemsDiv.AppendChild(itemsSubSpan);

            return(itemsDiv);
        }
Exemplo n.º 7
0
        public static DivElement CreatePanelBody()
        {
            var body = new DivElement
            {
                ClassName = "panel-body"
            };

            var name    = Html5App.CreateFormField("Name", "user");
            var email   = Html5App.CreateFormField("Email", "globe");
            var message = Html5App.CreateFormField("Message", "pencil");

            Element[] dateTime = Html5App.CreateDateTimeField();

            body.AppendChild(name);
            body.AppendChild(email);
            body.AppendChild(message);
            body.AppendChild(dateTime[0]);
            body.AppendChild(dateTime[1]);

            return(body);
        }
        internal void Show(Vector2d position)
        {
            DivElement menu = Document.GetElementById <DivElement>("contextmenu");

            while (menu.FirstChild != null)
            {
                menu.RemoveChild(menu.FirstChild);
            }

            menu.ClassName     = "contextmenu";
            menu.Style.Display = "block";
            menu.Style.Left    = position.X.ToString() + "px";
            menu.Style.Top     = position.Y.ToString() + "px";

            Window.AddEventListener("click", NonMenuClick, true);

            foreach (ToolStripMenuItem item in Items)
            {
                if (item.Visible)
                {
                    DivElement md = (DivElement)Document.CreateElement("div");
                    if (item.DropDownItems.Count > 0)
                    {
                        md.ClassName = "contextmenuitem submenu";
                    }
                    else
                    {
                        if (item.Checked)
                        {
                            md.ClassName = "contextmenuitem checkedmenu";
                        }
                        else
                        {
                            md.ClassName = "contextmenuitem";
                        }
                    }
                    md.InnerText = item.Name;

                    TagMe it = (TagMe)(Object)md;
                    it.ItemTag = item;

                    md.AddEventListener("mouseover", OpenSubMenu, false);

                    if (item.Click != null)
                    {
                        md.AddEventListener("click", MenuItemClicked, false);
                    }

                    menu.AppendChild(md);
                }
            }
        }
Exemplo n.º 9
0
        public static void DefineNiceController()
        {
            AngularJSDemo.hwbApp.Controller <ControllerDataObjectStructure>
                ("hwcSctl", CtlFunction);

            var ctlDiv = new DivElement();

            ctlDiv.SetNGController("hwcSctl");
            Document.Body.AppendChild(ctlDiv);

            var fltFld = new InputElement();

            fltFld.SetNGModel("hwcFlt");
            ctlDiv.AppendChild(fltFld);

            var ordFld = new SelectElement();

            ordFld.SetNGModel("hwcOrderBy");
            ordFld.Add(new OptionElement()
            {
                Value     = "Checkpoint",
                InnerHTML = "Alphabetically"
            });
            ordFld.Add(new OptionElement()
            {
                Value     = "id",
                InnerHTML = "Series ID"
            });
            ctlDiv.AppendChild(ordFld);

            var rptSpan = new SpanElement();

            rptSpan.SetNGRepeat("checkpoint", "checkpoints", fltFld.GetNGModel(),
                                ordFld.GetNGModel());
            rptSpan.InnerHTML = "{{checkpoint.callsign}}[{{checkpoint.id}}] ";
            ctlDiv.AppendChild(rptSpan);
        }
        internal void OpenSubMenu(ElementEvent e)
        {
            TagMe             me    = (TagMe)(Object)e.CurrentTarget;
            ToolStripMenuItem child = me.ItemTag;

            DivElement menu = Document.GetElementById <DivElement>("popoutmenu");

            while (menu.FirstChild != null)
            {
                menu.RemoveChild(menu.FirstChild);
            }

            menu.Style.Display = "none";

            if (child.DropDownItems.Count == 0)
            {
                return;
            }

            Vector2d position = new Vector2d();

            position.X = e.CurrentTarget.ParentNode.OffsetLeft + e.CurrentTarget.ParentNode.ClientWidth;
            position.Y = e.CurrentTarget.ParentNode.OffsetTop + e.CurrentTarget.OffsetTop;


            menu.ClassName     = "contextmenu";
            menu.Style.Display = "block";
            menu.Style.Left    = position.X.ToString() + "px";
            menu.Style.Top     = position.Y.ToString() + "px";

            Window.AddEventListener("click", NonMenuClick, true);

            foreach (ToolStripMenuItem item in child.DropDownItems)
            {
                if (item.Visible)
                {
                    DivElement md = (DivElement)Document.CreateElement("div");
                    md.ClassName = item.Checked ? "contextmenuitem checkedmenu" : "contextmenuitem";
                    md.InnerText = item.Name;

                    TagMe it = (TagMe)(Object)md;
                    it.ItemTag = item;

                    md.AddEventListener("click", MenuItemClicked, false);
                    menu.AppendChild(md);
                }
            }
        }
Exemplo n.º 11
0
        public static DivElement CreatePanelHeader()
        {
            var header = new DivElement
            {
                ClassName = "panel-heading logo"
            };

            var title = new HeadingElement
            {
                InnerHTML = "Bridge.NET HTML5 Demo"
            };

            header.AppendChild(title);

            return(header);
        }
Exemplo n.º 12
0
        public static DivElement CreatePanelFooter()
        {
            var footer = new DivElement
            {
                ClassName = "panel-footer text-right"
            };

            var button = new InputElement
            {
                Type       = InputType.Submit,
                Value      = "Submit",
                ClassName  = "btn btn-success",
                FormAction = Config.SUBMIT_URL,
                FormMethod = "POST"
            };

            footer.AppendChild(button);

            return(footer);
        }
Exemplo n.º 13
0
		public Popup(Controller controller, string title, Room room, HtmlItem[] items)
		{
			Title = title;
			RoomGuid = room.Guid;
			Removed = false;
			RoomGuidForClickAction = room.Guid;
			//RoomGuidForClickAction = item.GetRoomGuidForChatClickAction();


			#region //Holder
			Holder = (DivElement)Document.CreateElement("div");
			Holder.ClassName = "ChatClientPopup";
			Holder.Style.Width = PopupArea.PopupWidth.ToString() + "px";
			Holder.Style.Height = PopupArea.PopupHeight.ToString() + "px";
			
			#region //HeaderDiv
			DOMElement header = (DOMElement)Document.CreateElement("div");
			header.ClassName = "ChatClientPopupHeader";
			header.Style.Overflow = "hidden";

			{
				#region //Close button
				DivElement div = (DivElement)Document.CreateElement("div");
				div.ClassName = "ChatClientPopupCloseLinkHolder";

				{
					AnchorElement link = (AnchorElement)Document.CreateElement("a");
					link.InnerHTML = "Close";
					link.Href = "";
					DomEvent.AddHandler(link, "click", new DomEventHandler(closeButtonClick));
					div.AppendChild(link);
				}
				header.AppendChild(div);
				#endregion
			}

			{
				#region //TitleDiv
				DivElement div = (DivElement)Document.CreateElement("div");
				div.ClassName = "ChatClientPopupTitle";
				div.InnerHTML = Title;
				header.AppendChild(div);
				#endregion
			}

			Holder.AppendChild(header);
			
			#endregion

			#region //ItemsDiv
			{
				if (items != null)
				{
					ItemsList = (DivElement)Document.CreateElement("div");
					ItemsList.ClassName = "ChatClientPopupItemsList";

					DomEvent.AddHandler(ItemsList, "click", new DomEventHandler(holderClick));
					DomEvent.AddHandler(ItemsList, "mouseover", new DomEventHandler(holderMouseOver));
					DomEvent.AddHandler(ItemsList, "mouseout", new DomEventHandler(holderMouseOut));

					bool hasMultipleRelevantItems = false;
					for (int i = 0; i < items.Length; i++)
					{
						HtmlItem item = (HtmlItem)items[i];

						#region // if the item is posted by the current user, we never want to show a popup
						if (item is IHasPostingUsr)
						{
							if (((IHasPostingUsr)item).PostingUsrK == controller.UsrK)
								continue;
						}
						#endregion

						if (HasRelevantItems)
						{
							hasMultipleRelevantItems = true;
							break;
						}

						HasRelevantItems = true;
					}
					if (HasRelevantItems)
					{
						for (int i = 0; i < items.Length; i++)
						{
							HtmlItem item = (HtmlItem)items[i];

							#region // if the item is posted by the current user, we never want to show a popup
							if (item is IHasPostingUsr)
							{
								if (((IHasPostingUsr)item).PostingUsrK == controller.UsrK)
									continue;
							}
							#endregion

							if (!hasMultipleRelevantItems)
								RoomGuidForClickAction = item.GetRoomGuidForChatClickAction();

							#region //bodge it so it displays correctly - remember to save all things we change
							int previousInstance = item.Instance;
							bool previousNewStatus = false;
							if (item is Newable)
							{
								previousNewStatus = ((Newable)item).IsInNewSection;
								((Newable)item).IsInNewSection = false;
							}
							item.Instance = 2;

							bool previousShowChatButton = false;
							if (!hasMultipleRelevantItems && item is Message) // we only hide the chat button if there's only one item shown. for multi-item popups we want to leave the chat buttons as they were.
							{
								previousShowChatButton = ((Message)item).ShowChatButton;
								((Message)item).ShowChatButton = false;
							}
							#endregion

							DOMElement itemNode = Document.CreateElement("span");
							itemNode.InnerHTML = item.ToHtml();

							if (ItemsList.HasChildNodes())
								ItemsList.InsertBefore(itemNode, ItemsList.ChildNodes[0]);
							else
								ItemsList.AppendChild(itemNode);

							#region //restore all the things we bodged

							item.Instance = previousInstance;

							if (item is Newable)
								((Newable)item).IsInNewSection = previousNewStatus;
							
							if (!hasMultipleRelevantItems && item is Message) // we only hide the chat button if there's only one item shown. for multi-item popups we want to leave the chat buttons as they were.
								((Message)item).ShowChatButton = previousShowChatButton;

							#endregion

						}
						Holder.AppendChild(ItemsList);
					}
				}
			}
			#endregion

			#endregion

			Id = Math.Random().ToString();
			jHolder = JQueryAPI.JQuery(Holder);
		}
Exemplo n.º 14
0
        private static void LoadPlayArea()
        {
            var menuDiv = new DivElement
            {
                Id = "menu"
            };

            var pressStartTitle = new AnchorElement
            {
                Href      = "javascript:BridgeTetris.Tetris.play()",
                InnerHTML = "Press Space to Play."
            };

            menuDiv.AppendChild(BridgeTetris.Tetris.InsideParagraph(pressStartTitle, "start"));

            var nextPieceCanvas = new CanvasElement
            {
                Id = "upcoming"
            };

            menuDiv.AppendChild(BridgeTetris.Tetris.InsideParagraph(nextPieceCanvas));

            var scoreParagraph = new List <Node>();

            scoreParagraph.Add(new LabelElement
            {
                InnerHTML = "score "
            });

            scoreParagraph.Add(new SpanElement
            {
                Id        = "score",
                InnerHTML = "00000"
            });

            menuDiv.AppendChild(BridgeTetris.Tetris.InsideParagraph(scoreParagraph));

            var rowsParagraph = new List <Node>();

            rowsParagraph.Add(new LabelElement
            {
                InnerHTML = "rows "
            });

            rowsParagraph.Add(new SpanElement
            {
                Id        = "rows",
                InnerHTML = "0"
            });

            menuDiv.AppendChild(BridgeTetris.Tetris.InsideParagraph(rowsParagraph));

            var tetrisCourtCanvas = new CanvasElement
            {
                Id     = "canvas",
                Width  = 200,
                Height = 400
            };

            var tetrisDiv = new DivElement
            {
                Id = "tetris"
            };

            tetrisDiv.AppendChild(menuDiv);
            tetrisDiv.AppendChild(tetrisCourtCanvas);

            Document.Body.AppendChild(tetrisDiv);
        }
Exemplo n.º 15
0
        public static ModalDlg Make(string titleText, string bodyText, string id)
        {
            DivElement myModal = new DivElement();

            myModal.ClassName = "modal fade";
            myModal.Id        = id;
            myModal.SetAttribute("role", "dialog");
            jQuery jq = new jQuery(myModal).On("hidden.bs.modal", OnHidden);


            DivElement modalDlg = new DivElement();

            modalDlg.ClassName = "modal-dialog-sm";
            myModal.AppendChild(modalDlg);


            DivElement modalContent = new DivElement();

            modalContent.ClassName = "modal-content";
            modalDlg.AppendChild(modalContent);

            DivElement modalHeader = new DivElement();

            modalHeader.ClassName = "modal-header";
            modalContent.AppendChild(modalHeader);

            ButtonElement button = new ButtonElement();

            button.SetAttribute("type", "button");
            button.ClassName = "close";
            button.SetAttribute("data-dismiss", "modal");
            button.InnerHTML = "&times;";
            modalHeader.AppendChild(button);

            HeadingElement title = new HeadingElement(HeadingType.H4);

            title.ClassName = "modal-title";
            title.InnerHTML = titleText;
            modalHeader.AppendChild(title);


            DivElement modalBody = new DivElement();

            modalBody.ClassName = "modal-body";
            modalContent.AppendChild(modalBody);

            ParagraphElement bodyContent = new ParagraphElement();

            bodyContent.InnerHTML = bodyText;
            modalBody.AppendChild(bodyContent);

            DivElement footer = new DivElement();

            footer.ClassName = "modal-footer";


            ButtonElement footerButton = new ButtonElement();

            footerButton.SetAttribute("type", "button");
            footerButton.ClassName = "btn btn-default";
            footerButton.SetAttribute("data-dismiss", "modal");
            footerButton.InnerHTML = "Close";

            footer.AppendChild(footerButton);
            modalContent.AppendChild(footer);

            Document.Body.AppendChild(myModal);

            ModalDlg dlg = new ModalDlg();

            dlg.TopElement  = myModal;
            dlg.Body        = modalBody;
            dlg.Title       = title;
            dlg.BodyContent = bodyContent;
            dlg.Footer      = footer;
            dlg.id          = id;
            return(dlg);
        }