Пример #1
0
        public void Show(Vector2d position)
        {
            tile = (SkyImageTile)TileCache.GetTile(0, 0, 0, layer.ImageSet, null);

            DivElement picker   = Document.GetElementById <DivElement>("histogram");
            DivElement closeBtn = Document.GetElementById <DivElement>("histogramClose");

            /////////////picker.ClassName = "histogram";
            picker.Style.Display = "block";
            picker.Style.Left    = position.X.ToString() + "px";
            picker.Style.Top     = position.Y.ToString() + "px";

            SelectedCurveStyle = (int)image.lastScale;


            dropDown = Document.GetElementById <SelectElement>("ScaleTypePicker");

            dropDown.AddEventListener("change", CurveStyleSelected, false);
            dropDown.AddEventListener("click", IgnoreMe, true);
            CanvasElement canvas = Document.GetElementById <CanvasElement>("graph");

            canvas.AddEventListener("mousedown", MouseDown, false);
            canvas.AddEventListener("mousemove", mousemove, false);
            canvas.AddEventListener("mouseup", mouseup, false);
            closeBtn.AddEventListener("click", Close, true);

            Draw();
        }
Пример #2
0
            public UrlData(string url)
            {
                Url = url;

                if (!string.IsNullOrWhiteSpace(Url))
                {
                    Document   = XDocument.Parse(Url);
                    DivElement = Document.Element("div");
                    string href = DivElement.Element("a").Attribute("href").Value;
                    string id   = string.IsNullOrWhiteSpace(href) ? "" : HttpUtility.UrlDecode(href.Substring(href.IndexOf('=') + 1));

                    if (id != null && id.Contains("&"))
                    {
                        Id = id.Substring(0, id.IndexOf("&"));
                        var parms    = id.Substring(id.IndexOf("&")).Split('&');
                        var parmDict = parms.Where(s => s.Contains("=")).Select(p => p.Split('=')).ToDictionary(arr => arr[0], arr => arr[1]);

                        Page     = parmDict.ContainsKey(IdHelper.PageKey) ? parmDict[IdHelper.PageKey] : "";
                        PageSize = parmDict.ContainsKey(IdHelper.PageSizeKey) ? parmDict[IdHelper.PageSizeKey] : "";
                        Format   = parmDict.ContainsKey(IdHelper.FormatKey) ? parmDict[IdHelper.FormatKey] : "";
                    }
                    else
                    {
                        Id = id;
                    }
                    Type = string.IsNullOrWhiteSpace(Id) ? "" : Id.Substring(0, Id.IndexOf(";"));
                }
            }
        public void Show(Vector2d position, Action callback)
        {
            DivElement simpleInputElement = Document.GetElementById <DivElement>("simpleinput");
            DivElement modalElement       = Document.GetElementById <DivElement>("simplemodal");

            modalElement.Style.Display          = "block";
            simpleInputElement.Style.Display    = "block";
            simpleInputElement.Style.MarginLeft = position.X.ToString() + "px";
            simpleInputElement.Style.MarginTop  = position.Y.ToString() + "px";

            textElement       = Document.GetElementById <SelectElement>("inputtext");
            textElement.Value = Text;

            DivElement titleDiv = Document.GetElementById <DivElement>("simpletitle");
            DivElement labelDiv = Document.GetElementById <DivElement>("inputlabel");

            titleDiv.InnerText = Title;
            labelDiv.InnerText = Label;



            textElement.AddEventListener("change", TextChanged, false);
            textElement.AddEventListener("click", IgnoreMe, true);

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

            AnchorElement okButton     = Document.GetElementById <AnchorElement>("simpleinputok");
            AnchorElement cancelButton = Document.GetElementById <AnchorElement>("simpleinputcancel");

            okButton.AddEventListener("click", OkClicked, false);
            cancelButton.AddEventListener("click", CancelClicked, false);
            okCallback = callback;
        }
Пример #4
0
        public static void Test()
        {
            InputElement input = new InputElement();

            input.OnChange += (ev) =>
            {
                // Tests if ev.CurrentTarget.Value compiles
                Console.Log("ev.CurrentTarget.Value: " + ev.CurrentTarget.Value);

                // Tests if ev.IsMouseEvent() compiles
                Console.Log("IsMouseEvent: " + ev.IsMouseEvent());
            };

            AnchorElement anchor = new AnchorElement();

            anchor.OnClick += (ev) =>
            {
                // Tests if ev.CurrentTarget.Href compiles
                Console.Log("ev.CurrentTarget.Href: " + ev.CurrentTarget.Href);
            };

            // Test if Document.GetElementById<>() compiles
            DivElement div = Document.GetElementById <DivElement>("div1");

            // Tests if Element is still a superclass of all the element classes and the following code compiles
            Element element;

            element = new InputElement();
            element = new TextAreaElement();
        }
Пример #5
0
        public WebScreen(WebScreenManager webScreenManager)
        {
            ScreenManager = webScreenManager;

            WebLayouts = new List <WebLayout>();
            Element    = (DivElement)Document.CreateElement("div");
        }
        public static void Run()
        {
            // ExStart:CreateStructureElements
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdf_WorkingDocuments();

            // Create Pdf Document
            Document document = new Document();

            // Get Content for work with TaggedPdf
            ITaggedContent taggedContent = document.TaggedContent;

            // Set Title and Language for Documnet
            taggedContent.SetTitle("Tagged Pdf Document");
            taggedContent.SetLanguage("en-US");

            // Create Grouping Elements
            PartElement       partElement       = taggedContent.CreatePartElement();
            ArtElement        artElement        = taggedContent.CreateArtElement();
            SectElement       sectElement       = taggedContent.CreateSectElement();
            DivElement        divElement        = taggedContent.CreateDivElement();
            BlockQuoteElement blockQuoteElement = taggedContent.CreateBlockQuoteElement();
            CaptionElement    captionElement    = taggedContent.CreateCaptionElement();
            TOCElement        tocElement        = taggedContent.CreateTOCElement();
            TOCIElement       tociElement       = taggedContent.CreateTOCIElement();
            IndexElement      indexElement      = taggedContent.CreateIndexElement();
            NonStructElement  nonStructElement  = taggedContent.CreateNonStructElement();
            PrivateElement    privateElement    = taggedContent.CreatePrivateElement();

            // Create Text Block-Level Structure Elements
            ParagraphElement paragraphElement = taggedContent.CreateParagraphElement();
            HeaderElement    headerElement    = taggedContent.CreateHeaderElement();
            HeaderElement    h1Element        = taggedContent.CreateHeaderElement(1);

            // Create Text Inline-Level Structure Elements
            SpanElement  spanElement  = taggedContent.CreateSpanElement();
            QuoteElement quoteElement = taggedContent.CreateQuoteElement();
            NoteElement  noteElement  = taggedContent.CreateNoteElement();

            // Create Illustration Structure Elements
            FigureElement  figureElement  = taggedContent.CreateFigureElement();
            FormulaElement formulaElement = taggedContent.CreateFormulaElement();

            // Methods are under development
            ListElement      listElement      = taggedContent.CreateListElement();
            TableElement     tableElement     = taggedContent.CreateTableElement();
            ReferenceElement referenceElement = taggedContent.CreateReferenceElement();
            BibEntryElement  bibEntryElement  = taggedContent.CreateBibEntryElement();
            CodeElement      codeElement      = taggedContent.CreateCodeElement();
            LinkElement      linkElement      = taggedContent.CreateLinkElement();
            AnnotElement     annotElement     = taggedContent.CreateAnnotElement();
            RubyElement      rubyElement      = taggedContent.CreateRubyElement();
            WarichuElement   warichuElement   = taggedContent.CreateWarichuElement();
            FormElement      formElement      = taggedContent.CreateFormElement();

            // Save Tagged Pdf Document
            document.Save(dataDir + "StructureElements.pdf");
            // ExEnd:CreateStructureElements
        }
Пример #7
0
		public PopupMenu(string cssClass, string highlightedItemCssClass)
		{
			container = (DivElement) Document.CreateElement("DIV");
			container.ClassName = cssClass == null ? "PopupMenu" : cssClass;
			this.highlightedItemCssClass = highlightedItemCssClass == null ? "PopupMenuHighlightedItem" : highlightedItemCssClass;
			container.Style.Display = "none";
			Document.Body.AppendChild(container);
		}
Пример #8
0
        public void NonMenuClick(ElementEvent e)
        {
            DivElement menu = Document.GetElementById <DivElement>("colorpicker");

            menu.Style.Display = "none";
            Window.RemoveEventListener("click", NonMenuClick, true);

            ImageElement image = Document.GetElementById <ImageElement>("colorhex");

            image.RemoveEventListener("click", PickColor, false);
        }
        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);
                }
            }
        }
Пример #10
0
        public WebLayout(IScreen screen, int width, int height)
        {
            Screen = screen;
            Width  = width;
            Height = height;

            ScreenOrientation = ScreenOrientation.Vertical;
            LayoutPosition    = new LayoutPosition(new Size(width, height));

            Element = (DivElement)Document.CreateElement("div");

            UIManager = new WebUIManager(this);
        }
        private void Close()
        {
            DivElement simpleInputElement = Document.GetElementById <DivElement>("simplemodal");

            simpleInputElement.Style.Display = "none";
            //Window.RemoveEventListener("click", NonMenuClick, true);
            textElement.RemoveEventListener("change", TextChanged, false);

            AnchorElement okButton     = Document.GetElementById <AnchorElement>("simpleinputok");
            AnchorElement cancelButton = Document.GetElementById <AnchorElement>("simpleinputcancel");

            okButton.RemoveEventListener("click", OkClicked, false);
            cancelButton.RemoveEventListener("click", CancelClicked, false);
        }
Пример #12
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 });
        }
Пример #13
0
        /// <summary>
        ///     Creates and adds another newForm to the page.
        /// </summary>
        /// <param name="newForm"></param>
        internal static void ShowNewForm(Form newForm)
        {
            var sharpJSApp     = new WebApplication(Theme);
            var hostElement    = Document.GetElementById(HostElementId);
            var newFormHost    = new DivElement();
            var jqMainFormHost = new JQElement(newFormHost);

            hostElement.AppendChild(newFormHost);
            var newWebForm = newForm.UnderlyingWebForm;

            newWebForm.InternalJQElement.Css("position", "relative"); //To allow child control positioning
            Forms.Add(newWebForm, newFormHost);
            sharpJSApp.Run(newWebForm, jqMainFormHost);
            InitializeWebUIElement(newForm, newWebForm);
        }
Пример #14
0
        public void Show(Vector2d position)
        {
            DivElement picker = Document.GetElementById <DivElement>("colorpicker");

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

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

            ImageElement image = Document.GetElementById <ImageElement>("colorhex");

            image.AddEventListener("mousedown", PickColor, false);
        }
        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);
                }
            }
        }
Пример #16
0
        /// <summary>
        /// Ensures the div element with qunit-fixture exists.
        /// QUnit automatically cleans qunit-fixture div after each test. You should only rely on the fixture markup, inside the #qunit-fixture element.
        /// </summary>
        /// <returns></returns>
        private static DivElement EnsureTestFixture()
        {
            var fixture = Bridge.Html5.Document.GetElementById <DivElement>("qunit-fixture");

            if (fixture == null)
            {
                fixture = new DivElement()
                {
                    Id = "qunit-fixture"
                };

                Document.Body.AppendChild(fixture);
            }

            return(fixture);
        }
Пример #17
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);
        }
Пример #18
0
        public void Close(ElementEvent e)
        {
            DivElement menu     = Document.GetElementById <DivElement>("histogram");
            DivElement closeBtn = Document.GetElementById <DivElement>("histogramClose");

            menu.Style.Display = "none";
            Window.RemoveEventListener("click", Close, true);

            ImageElement image = Document.GetElementById <ImageElement>("graph");

            image.RemoveEventListener("mousedown", MouseDown, false);
            image.RemoveEventListener("mousemove", mousemove, false);
            image.RemoveEventListener("mouseup", mouseup, false);
            dropDown.RemoveEventListener("change", CurveStyleSelected, false);
            dropDown.RemoveEventListener("click", IgnoreMe, true);
        }
        internal void NonMenuClick(ElementEvent e)
        {
            DivElement menu = Document.GetElementById <DivElement>("contextmenu");

            menu.Style.Display = "none";
            Window.RemoveEventListener("click", NonMenuClick, false);


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

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

            popup.Style.Display = "none";
        }
Пример #20
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);
        }
Пример #21
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);
        }
Пример #22
0
        public override ErrorList Validate()
        {
            var result = new ErrorList();

            result.AddRange(base.Validate());

            if (StatusElement != null)
            {
                result.AddRange(StatusElement.Validate());
            }
            if (DivElement != null)
            {
                result.AddRange(DivElement.Validate());
            }

            return(result);
        }
Пример #23
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);
        }
Пример #24
0
        public static void TestUseCase(Assert assert)
        {
            assert.Expect(3);

            var root = Document.GetElementById("qunit-fixture");

            var button1 = new ButtonElement();

            button1.InnerHTML   = "Button 1";
            button1.Id          = "button1";
            button1.Style.Color = HTMLColor.Green;

            root.AppendChild(button1);

            var b1 = Document.GetElementById("button1");

            assert.Equal(b1.Style.Color, "green", "b1.Style.Color green");

            var button2 = new ButtonElement();

            button2.InnerHTML             = "Button 2";
            button2.Id                    = "button2";
            button2.Style.BackgroundColor = "yellow";

            root.AppendChild(button2);

            var b2 = Document.GetElementById("button2");

            assert.Equal(b2.Style.BackgroundColor, HTMLColor.Yellow, "b2.Style.BackgroundColor HTMLColor.Yellow");

            var hexColor    = "#FFEEAA";
            var divElement1 = new DivElement();

            divElement1.InnerHTML   = "Div 1";
            divElement1.Id          = "div1";
            divElement1.Style.Color = hexColor;

            root.AppendChild(divElement1);

            var div1 = Document.GetElementById("div1");

            assert.Equal(div1.Style.Color, "rgb(255, 238, 170)", "div1.Style.Color " + hexColor);
        }
Пример #25
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);
        }
Пример #26
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);
        }
Пример #27
0
		public Controller(View view)
		{
			this.view = view;

			threadCommentsProvider = new ThreadCommentsProvider(commentsPerPage);
			threadCommentsProvider.CommentsAnchorName = (string)view.uiCommentsAnchor.GetAttribute("name");
			threadCommentsProvider.OnLoaded = new EventHandler(display);

			hideCommentsPanelServerSide();

			uiCommentsCount = (DivElement)Document.CreateElement("center");
			view.uiCommentsPanelClientSide.AppendChild(uiCommentsCount);

			uiPaging1Div = (DivElement)Document.CreateElement("div");
			uiPaging1Div.Style.TextAlign = "right";
			view.uiCommentsPanelClientSide.AppendChild(uiPaging1Div);
			uiCommentsDiv = (DivElement)Document.CreateElement("div");
			view.uiCommentsPanelClientSide.AppendChild(uiCommentsDiv);
			uiPaging2Div = (DivElement)Document.CreateElement("div");
			uiPaging2Div.Style.TextAlign = "right";
			view.uiCommentsPanelClientSide.AppendChild(uiPaging2Div);
		}
Пример #28
0
        static void Main(string[] args)
        {
            var div       = new DivElement();
            var paragraph = new PElement();
            var br        = new BrElement();
            var text      = new TextElement("Example text");
            var image     = new ImageElement();

            image.SetAttribute("src", "http://opensourceforu.com/wp-content/uploads/2016/03/Microsoft.png");
            paragraph.Add(text);
            paragraph.Add(br);
            div.Add(image);
            div.Add(paragraph);

            Console.WriteLine("Render div:");
            Console.Write(div.Render());

            Console.WriteLine("Render paragraph:");
            Console.Write(paragraph.Render());

            Console.WriteLine("It works");
        }
Пример #29
0
        public void Initialize()
        {
            ConsoleLog = Document.GetElementById<DivElement>("consoleLog");

            WebSocketSupportImage = Document.GetElementById<ImageElement>("wsSupportImg");

            WebSocketSupported = Document.GetElementById<DivElement>("webSocketSupp");

            WebSocketNotSupported = Document.GetElementById<DivElement>("noWebSocketSupp");

            UseSecureWebSocketInput = Document.GetElementById<InputElement>("secureCb");
            UseSecureWebSocketInput.Checked = false;
            UseSecureWebSocketInput.OnClick += OnClick_UseSecureWebSocket;

            LocationInput = Document.GetElementById<InputElement>("wsUri");

            MessageInput = Document.GetElementById<InputElement>("sendMessage");

            ConnectButton = Document.GetElementById<ButtonElement>("connect");
            ConnectButton.OnClick += OnClick_ConnectButton;

            DisconnectButton = Document.GetElementById<ButtonElement>("disconnect");
            DisconnectButton.OnClick += OnClick_DisconnectButton;

            SendButton = Document.GetElementById<ButtonElement>("send");
            SendButton.OnClick += OnClick_SendButton;

            ClearLogButton = Document.GetElementById<ButtonElement>("clearLogBut");
            ClearLogButton.OnClick += OnClick_ClearLogButton;

            Window.OnBeforeUnload += (e) => { if (OnViewShuttingUp != null) { OnViewShuttingUp(this, new EventArgs()); } };

            if (OnViewInitialized != null)
            {
                OnViewInitialized(this, new EventArgs());
            }
        }
Пример #30
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);
        }
Пример #31
0
        public void PickColor(ElementEvent e)
        {
            DivElement picker = Document.GetElementById <DivElement>("colorpicker");

            ImageElement image = Document.GetElementById <ImageElement>("colorhex");

            CanvasElement canvas = (CanvasElement)Document.CreateElement("canvas");

            canvas.Width  = image.Width;
            canvas.Height = image.Height;

            CanvasContext2D ctx = (CanvasContext2D)canvas.GetContext(Rendering.Render2D);

            ctx.DrawImage(image, 0, 0);

            PixelArray pixels = ctx.GetImageData(e.OffsetX, e.OffsetY, 1, 1).Data;

            Color = Color.FromArgb((float)pixels[3], (float)pixels[0], (float)pixels[1], (float)pixels[2]);

            if (CallBack != null)
            {
                CallBack(Color);
            }
        }
Пример #32
0
 public WebForm()
 {
     InternalElement = new DivElement();
     PerformLayout();
 }
Пример #33
0
		void changePanel(DivElement panel)
		{
			View.Vote1Panel.Style.Display = panel == View.Vote1Panel ? "" : "none";
			View.VoteConfirmPanel.Style.Display = panel == View.VoteConfirmPanel ? "" : "none";
			View.VoteLikePanel.Style.Display = panel == View.VoteLikePanel ? "" : "none";
			View.Vote2Panel.Style.Display = panel == View.Vote2Panel ? "" : "none";
		}
Пример #34
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);
		}
Пример #35
0
		void changePanel(DivElement panel)
		{
			View.Entry1Panel.Style.Display = panel == View.Entry1Panel ? "" : "none";
			View.EntryConfirmPanel.Style.Display = panel == View.EntryConfirmPanel ? "" : "none";
			View.Entry2Panel.Style.Display = panel == View.Entry2Panel ? "" : "none";
		}
Пример #36
0
		void changePanel(DivElement panel)
		{
			View.Repost1Panel.Style.Display = panel == View.Repost1Panel ? "" : "none";
			View.RepostConfirmPanel.Style.Display = panel == View.RepostConfirmPanel ? "" : "none";
			View.Repost2Panel.Style.Display = panel == View.Repost2Panel ? "" : "none";
		}