示例#1
0
        private HTMLAnchorElement GetAnchorElement(HTMLDocument htmlDocument, string buttonText)
        {
            HTMLAnchorElement anchorElement = (HTMLAnchorElement)htmlDocument.CreateElement("a");

            Text backwardText = htmlDocument.CreateTextNode(buttonText);

            anchorElement.SetAttribute("class", "button");
            anchorElement.AppendChild(backwardText);
            return(anchorElement);
        }
示例#2
0
 public LinkBuilder DataToggle(String value)
 {
     anchor.SetAttribute("data-toggle", value);
     return(this);
 }
示例#3
0
文件: App.cs 项目: landon/Playground
        public static void NewTab(string name = null, Graph G = null)
        {
            if (string.IsNullOrEmpty(name))
            {
                name = "sheet " + _tabID;
            }

            var canvas = new HTMLCanvasElement();

            canvas.Id        = "Tab" + _tabID;
            canvas.Width     = (int)(Window.InnerWidth);
            canvas.Height    = (int)(Window.InnerHeight);
            canvas.ClassName = "IAmAGraphCanvas";

            canvas.OnShow += delegate
            {
                canvas.Width  = canvas.ParentElement.ClientWidth;
                canvas.Height = canvas.ParentElement.ClientHeight;
            };

            if (G == null)
            {
                G = new Graph();
            }
            var graphCanvas = new GraphCanvas(G);
            var tc          = new TabCanvas(canvas, graphCanvas);

            tc.Invalidate();

            var tabPane = new HTMLDivElement();

            tabPane.ClassName = "tab-pane active";
            tabPane.Id        = "Tab" + _tabID;
            tabPane.AppendChild(canvas);

            var tabControlContent = Document.GetElementById("TabControlContent");

            foreach (var child in tabControlContent.Children)
            {
                child.ClassName = "tab-pane";
            }
            tabControlContent.AppendChild(tabPane);

            var tab = new HTMLLIElement();

            tab.ClassName = "active";

            var anchor = new HTMLAnchorElement();

            anchor.SetAttribute("data-toggle", "tab");
            anchor.TextContent         = name;
            anchor.Href                = "#Tab" + _tabID;
            _canvasLookup[anchor.Href] = tc;
            _currentTabCanvas          = anchor.Href;

            tab.AppendChild(anchor);

            var tabControl = Document.GetElementById("TabControl");

            foreach (var child in tabControl.Children)
            {
                child.ClassName = "narf";
            }
            tabControl.InsertBefore(tab, _newSheetTab);

            _tabID++;
        }