コード例 #1
0
        // reference:
        // http://apike.ca/prog_svg_basic.html
        // http://apike.ca/prog_svg_shapes.html
        // http://www.milescript.org/graphicsdemo.html
        // http://canarlake.org/index.cgi?theme=svg
        // http://srufaculty.sru.edu/david.dailey/svg/SVGAnimations.htm
        // http://srufaculty.sru.edu/david.dailey/svg/svg_questions.htm
        // http://www.w3.org/TR/2000/CR-SVG-20001102/masking.html#ObjectAndGroupOpacityProperties
        // http://jmvidal.cse.sc.edu/talks/canvassvg/gradient.xml?style=White
        // http://www.treebuilder.de/default.asp?file=163540.xml
        // http://www.ibm.com/developerworks/library/x-svgint/
        // http://starkravingfinkle.org/projects/richdraw/richdraw_demo.htm
        // http://www.dynamicdrive.com/dynamicindex11/editor.htm
        // http://draw.labs.autodesk.com/ADDraw/draw.html
        // http://yeonisalive.net/javascript/MindWeb001.php

        public VectorExample()
        {
            Native.Document.body.style.backgroundColor = Color.System.ThreeDFace;

            "h2".AttachToDocument().innerText = "svg + vml example";

            #region CreateButton
            Func<Action, string, IHTMLButton> CreateButton =
                (h, text) =>
                {
                    var btn = new IHTMLButton(text);

                    btn.AttachToDocument();

                    Action onclick =
                        delegate
                        {
                            h();
                            btn.Dispose();
                        };

                    btn.onclick +=
                        delegate
                        {
                            // onclick();

                            try
                            {
                                onclick();
                            }
                            catch (Exception ex)
                            {
                                btn.style.color = Color.Red;
                                btn.innerText = "error: " + ex.Message;
                            }
                        };

                    return btn;
                };
            #endregion


            var b1 = CreateButton(Test1, "svg hello world");
			b1.disabled = !ISVGElementBase.Settings.IsSupported;
            var b2 = CreateButton(Test2, "svg advanced");
			b2.disabled = !ISVGElementBase.Settings.IsSupported;
            var b3 = CreateButton(Test3, "vml (IE) hello world");
			b3.disabled = !IVMLElementBase.Settings.IsSupported;

            

			CreateButton(
				delegate
				{
					b1.disabled = false;
					b2.disabled = false;
					b3.disabled = false;
				}
			, "Override detection");
        }
コード例 #2
0
        /// <summary>
        /// This is a javascript application.
        /// </summary>
        /// <param name="page">HTML document rendered by the web server which can now be enhanced.</param>
        public Application(IApp page)
        {
            //new IHTMLPre { () => "loaded at " + new { DateTime.Now } }.AttachToDocument();
            new IHTMLPre { "loaded at " + new { DateTime.Now } }.AttachToDocument();

            Native.css[IHTMLElement.HTMLElementEnum.a].style.display = IStyle.DisplayEnum.block;




            new { }.With(
                async delegate
                {
                    var foo = new IHTMLAnchor { href = "#foo", innerText = "#foo" }.AttachToDocument();

                    var a = new AsyncHash { hash = "#foo" };

                    new IHTMLButton { "go foo" }.AttachToDocument().onclick += delegate
                    {
                        Native.document.location.hash = a.hash;
                    };



                    while (await a.onenter)
                    {
                        new IHTMLPre { "onenter" }.AttachToDocument();
                        foo.style.backgroundColor = "yellow";


                        await a.onexit;

                        new IHTMLPre { "onexit" }.AttachToDocument();
                        foo.style.backgroundColor = "";
                    }

                }
            );


            new { }.With(
              async delegate
              {
                  var bar = new IHTMLAnchor { href = "#bar", innerText = "#bar" }.AttachToDocument();

                  var a = new AsyncHash { hash = "#bar" };

                  new IHTMLButton { "go bar" }.AttachToDocument().onclick += delegate
                  {
                      //Native.document.location.hash = a.hash;

                      a.Go();
                  };




                  while (await a.onenter)
                  {
                      //new IHTMLPre { "onenter" }.AttachToDocument();
                      bar.style.backgroundColor = "cyan";


                      // using
                      var goback = new IHTMLButton { "go back" }.AttachToDocument();

                      goback.onclick += delegate
                      {
                          //Native.document.location.hash = a.hash;

                          //a.Go();

                          Native.window.history.back();
                      };

                      await a.onexit;

                      goback.Dispose();

                      //new IHTMLPre { "onexit" }.AttachToDocument();
                      bar.style.backgroundColor = "";
                  }

              }
          );


            new IHTMLAnchor { href = "", innerText = "go home with reload" }.AttachToDocument();
            //new IHTMLAnchor { href = "/", innerText = "go home" }.AttachToDocument();
            new IHTMLAnchor { href = "#", innerText = "go home" }.AttachToDocument();

            Native.window.onhashchange += delegate
            {
                new IHTMLPre { new { Native.document.location.hash } }.AttachToDocument();
            };


            // await hash of


            // await cancel
        }
コード例 #3
0
        /// <summary>
        /// This is a javascript application.
        /// </summary>
        /// <param name="page">HTML document rendered by the web server which can now be enhanced.</param>
        public Application(IApp page)
        {
            //new IHTMLPre { () => "loaded at " + new { DateTime.Now } }.AttachToDocument();
            new IHTMLPre {
                "loaded at " + new { DateTime.Now }
            }.AttachToDocument();

            Native.css[IHTMLElement.HTMLElementEnum.a].style.display = IStyle.DisplayEnum.block;



            new { }.With(
                async delegate
            {
                var foo = new IHTMLAnchor {
                    href = "#foo", innerText = "#foo"
                }.AttachToDocument();

                var a = new AsyncHash {
                    hash = "#foo"
                };

                new IHTMLButton {
                    "go foo"
                }.AttachToDocument().onclick += delegate
                {
                    Native.document.location.hash = a.hash;
                };



                while (await a.onenter)
                {
                    new IHTMLPre {
                        "onenter"
                    }.AttachToDocument();
                    foo.style.backgroundColor = "yellow";


                    await a.onexit;

                    new IHTMLPre {
                        "onexit"
                    }.AttachToDocument();
                    foo.style.backgroundColor = "";
                }
            }
                );


            new { }.With(
                async delegate
            {
                var bar = new IHTMLAnchor {
                    href = "#bar", innerText = "#bar"
                }.AttachToDocument();

                var a = new AsyncHash {
                    hash = "#bar"
                };

                new IHTMLButton {
                    "go bar"
                }.AttachToDocument().onclick += delegate
                {
                    //Native.document.location.hash = a.hash;

                    a.Go();
                };



                while (await a.onenter)
                {
                    //new IHTMLPre { "onenter" }.AttachToDocument();
                    bar.style.backgroundColor = "cyan";


                    // using
                    var goback = new IHTMLButton {
                        "go back"
                    }.AttachToDocument();

                    goback.onclick += delegate
                    {
                        //Native.document.location.hash = a.hash;

                        //a.Go();

                        Native.window.history.back();
                    };

                    await a.onexit;

                    goback.Dispose();

                    //new IHTMLPre { "onexit" }.AttachToDocument();
                    bar.style.backgroundColor = "";
                }
            }
                );


            new IHTMLAnchor {
                href = "", innerText = "go home with reload"
            }.AttachToDocument();
            //new IHTMLAnchor { href = "/", innerText = "go home" }.AttachToDocument();
            new IHTMLAnchor {
                href = "#", innerText = "go home"
            }.AttachToDocument();

            Native.window.onhashchange += delegate
            {
                new IHTMLPre {
                    new { Native.document.location.hash }
                }.AttachToDocument();
            };


            // await hash of


            // await cancel
        }