Esempio n. 1
0
        public void Add(object e)
        {
            // would this work for the compiled assets/html blocks too?

            var xXElement = e as XElement;

            if (xXElement != null)
            {
                // X:\jsc.svn\examples\javascript\test\TestHopFromIFrame\TestHopFromIFrame\Application.cs
                if (this.nodeName.ToLower() == "iframe")
                {
                    var aFileParts = new[] { xXElement.ToString() };
                    var oMyBlob    = new Blob(aFileParts, new { type = "text/html" });

                    var url = URL.createObjectURL(oMyBlob);

                    ((IHTMLIFrame)this).src = url;

                    return;
                }

                // X:\jsc.svn\examples\javascript\Test\vb\TestXElementLiteral\TestXElementLiteral\Application.vb
                this.appendChild(
                    xXElement.AsHTMLElement()
                    );

                return;
            }

            // X:\jsc.svn\examples\javascript\async\AsyncHistoricActivities\AsyncHistoricActivities\Application.cs

            // Implementing Collection Initializers
            // http://msdn.microsoft.com/en-us/library/bb384062.aspx

            // x:\jsc.svn\examples\javascript\async\asyncworkersourcesha1\asyncworkersourcesha1\application.cs
            var x = new ITextNode("" + e);

            // what if the object is anonymous
            // could we have special logic for it?

            // actually all we want to know is will ToString change. IToStringChangedEvent ?
            if (e is Stopwatch)
            {
                Native.window.onframe +=
                    ee =>
                {
                    x.nodeValue = "" + e;


                    // stop when stopwatch is paused?
                };
            }

            this.appendChild(x);
        }
        public IHTMLTableColumn[] AddRowAsColumns(params string[] e)
        {
            INode[] u = new INode[e.Length];

            for (int i = 0; i < e.Length; i++)
            {
                u[i] = new ITextNode(e[i]);
            }

            return AddRowAsColumns(u);
        }
Esempio n. 3
0
        public void Add(byte[] e)
        {
            // x:\jsc.svn\examples\javascript\async\asyncworkersourcesha1\asyncworkersourcesha1\application.cs

            var w = "";

            foreach (var item in e)
            {
                w += item.ToString("x2");
            }

            var x = new ITextNode(w);

            this.appendChild(x);
        }
Esempio n. 4
0
        public void Add(System.Func <object> e)
        {
            // Z:\jsc.svn\examples\javascript\data\GoogleMapsTracker\Application.cs

            // what about implicit operators for other elements?
            // X:\jsc.svn\examples\javascript\async\AsyncHistoricActivities\AsyncHistoricActivities\Application.cs

            // Implementing Collection Initializers
            // http://msdn.microsoft.com/en-us/library/bb384062.aspx

            var x    = e().ToString();
            var text = new ITextNode(x);

            this.appendChild(text);

            new Timer(
                t =>
            {
                if (text.parentNode == null)
                {
                    System.Console.WriteLine("INode.Add timer stopped");
                    t.Stop();
                    return;
                }

                var y = e().ToString();
                if (y != text.nodeValue)
                {
                    text.nodeValue = y;

                    return;
                }

                // how many iterations before we stop the timer?
            },

                // time to attach to DOM
                duetime: 33,
                interval: 1000 / 15
                );
        }