コード例 #1
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)
        {
            // X:\jsc.svn\examples\javascript\test\TestMemberInitExpression\TestMemberInitExpression\Application.cs

            // {{ Name = foo, FieldType = [native] String }}
            var x = new { foo = new xSpecial() };

            var f = x.GetType().GetFields()[0];

            new IHTMLPre { new { f.Name, f.FieldType } }.AttachToDocument();

            var xf = new sFieldInfo { InternalField = f };

            new IHTMLPre { new { xf.Name, xf.FieldType } }.AttachToDocument();
        }
コード例 #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)
        {
            {
                byte[] bytes =
                {
                    1, 0, 0, 0,
                    0, 1, 0, 0,
                    0, 0, 1, 0,
                    0, 0, 0, 1,
                };

                new IHTMLPre { new { bytes } }.AttachToDocument();
                new IHTMLPre { new { bytes.Length } }.AttachToDocument();
                new IHTMLPre { bytes.GetType() }.AttachToDocument();
            }

            {
                var bytes = new byte[16];

                new IHTMLPre { new { bytes } }.AttachToDocument();
                new IHTMLPre { new { bytes.Length } }.AttachToDocument();
                new IHTMLPre { bytes.GetType() }.AttachToDocument();
            }

            {
                float[] floats =
                {
                    1, 0, 0, 0,
                    0, 1, 0, 0,
                    0, 0, 1, 0,
                    0, 0, 0, 1,
                };

                new IHTMLPre { new { floats } }.AttachToDocument();
                new IHTMLPre { new { floats.Length } }.AttachToDocument();
                new IHTMLPre { floats.GetType() }.AttachToDocument();
            }


            {
                var floats = new float[16];

                new IHTMLPre { new { floats } }.AttachToDocument();
                new IHTMLPre { new { floats.Length } }.AttachToDocument();
                new IHTMLPre { floats.GetType() }.AttachToDocument();
            }

            {
                // using a local non const variable 
                // makes C# not use the InitializeArray helper?
                //var cubesize = 1.0f * 0.05f;
                const float cubesize = 1.0f * 0.05f;

                //h = 0.05;
                //j = [
                //  (-h),

                var vertices = new[]{
                    // Front face
                    -cubesize, -cubesize,  cubesize,
                     cubesize, -cubesize,  cubesize,
                     cubesize,  cubesize,  cubesize,
                    -cubesize,  cubesize,  cubesize,

                    // Back face
                    -cubesize, -cubesize, -cubesize,
                    -cubesize,  cubesize, -cubesize,
                     cubesize,  cubesize, -cubesize,
                     cubesize, -cubesize, -cubesize,

                    // Top face
                    -cubesize,  cubesize, -cubesize,
                    -cubesize,  cubesize,  cubesize,
                     cubesize,  cubesize,  cubesize,
                     cubesize,  cubesize, -cubesize,

                    // Bottom face
                    -cubesize, -cubesize, -cubesize,
                     cubesize, -cubesize, -cubesize,
                     cubesize, -cubesize,  cubesize,
                    -cubesize, -cubesize,  cubesize,

                    // Right face
                     cubesize, -cubesize, -cubesize,
                     cubesize,  cubesize, -cubesize,
                     cubesize,  cubesize,  cubesize,
                     cubesize, -cubesize,  cubesize,

                    // Left face
                    -cubesize, -cubesize, -cubesize,
                    -cubesize, -cubesize,  cubesize,
                    -cubesize,  cubesize,  cubesize,
                    -cubesize,  cubesize, -cubesize
                };

                //                { { Length = 72 } }
                //?function Array() { [native code]
                //    }
                new IHTMLPre { new { vertices } }.AttachToDocument();
                new IHTMLPre { new { vertices.Length } }.AttachToDocument();
                new IHTMLPre { vertices.GetType() }.AttachToDocument();
            }

            {
                // using a local non const variable 
                // makes C# not use the InitializeArray helper?
                //var cubesize = 1.0f * 0.05f;
                float cubesize = 1.0f * 0.05f;

                //h = 0.05;
                //j = [
                //  (-h),

                var vertices = new[]{
                    // Front face
                    -cubesize, -cubesize,  cubesize,
                     cubesize, -cubesize,  cubesize,
                     cubesize,  cubesize,  cubesize,
                    -cubesize,  cubesize,  cubesize,

                    // Back face
                    -cubesize, -cubesize, -cubesize,
                    -cubesize,  cubesize, -cubesize,
                     cubesize,  cubesize, -cubesize,
                     cubesize, -cubesize, -cubesize,

                    // Top face
                    -cubesize,  cubesize, -cubesize,
                    -cubesize,  cubesize,  cubesize,
                     cubesize,  cubesize,  cubesize,
                     cubesize,  cubesize, -cubesize,

                    // Bottom face
                    -cubesize, -cubesize, -cubesize,
                     cubesize, -cubesize, -cubesize,
                     cubesize, -cubesize,  cubesize,
                    -cubesize, -cubesize,  cubesize,

                    // Right face
                     cubesize, -cubesize, -cubesize,
                     cubesize,  cubesize, -cubesize,
                     cubesize,  cubesize,  cubesize,
                     cubesize, -cubesize,  cubesize,

                    // Left face
                    -cubesize, -cubesize, -cubesize,
                    -cubesize, -cubesize,  cubesize,
                    -cubesize,  cubesize,  cubesize,
                    -cubesize,  cubesize, -cubesize
                };

                //                { { Length = 72 } }
                //?function Array() { [native code]
                //    }
                new IHTMLPre { new { vertices } }.AttachToDocument();
                new IHTMLPre { new { vertices.Length } }.AttachToDocument();
                new IHTMLPre { vertices.GetType() }.AttachToDocument();
            }


        }