コード例 #1
0
        // }



        //        ILStringConversion Prepare System.Action`2[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]
        //ILStringConversion Prepare System.Action`3[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]
        //ILStringConversion Prepare System.Action`2[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[TestQuerySelectorFromServer.QMethod, TestQuerySelectorFromServer, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]
        //2448:01:01 RewriteToAssembly error: System.ArgumentException: Duplicate type name within an assembly.
        //   at System.Reflection.Emit.TypeBuilder.DefineType(RuntimeModule module, String fullname, Int32 tkParent, TypeAttributes attributes, Int32 tkEnclosingType, Int32[] interfaceTokens)

        public Task __QMethod_Invoke(QMethod qmethod, string selectorText, XElement InternalElement)
        {
            // how will jsc know all the possible inline calls?
            // do we have to do a trace of which methods are callable?
            // basically whoever calls onclick
            // shall be made callable as it calls query_onclick
            // which means it goes to the client
            // its like java throws.
            // this time areound its more [resumable]
            var m = typeof(ApplicationWebService).Assembly.ManifestModule.ResolveMethod(qmethod.MetadataToken);


            var before = InternalElement.ToString();

            var x = new QElement
            {
                selectorText              = selectorText,
                Context                   = this,
                InternalElement           = InternalElement,
                InternalElementConstuctor = qmethod
            };



            if (m.IsStatic)
            {
                m.Invoke(null, new[] { x });
            }

            var after = InternalElement.ToString();

            if (before != after)
            {
                this.query_setInternalElement(selectorText, InternalElement);
            }

            var xx = new TaskCompletionSource <string>();

            xx.SetResult("");
            return(xx.Task);
        }
コード例 #2
0
        public Task Fill()
        {
            // see also
            // X:\jsc.svn\examples\javascript\css\CSSContentDataSource\CSSContentDataSource\Application.cs


            {
                var selector = "[data-column='Column 1']";

                query_setInnerText(
                    selector,
                    new { selector, foo = "bar" }.ToString()
                    );
            }

            {
                var x = new QElement {
                    selectorText = "[data-column='Column 2']", Context = this
                };



                x.innerText = new { x.selectorText, foo = "bar 2" }.ToString();
                x.css.color = "blue";
                x.css.setProperty("text-decoration", "underline");
                x.css.hover.color = "red";

                x.css["[special]"].after.setProperty("content", "' !!! after a secondary click this text will appear by a css rule. the next click will reload the page via the server call'");

                x.onclick +=
                    e =>
                {
                    if (e.InternalElement.Attribute("special") == null)
                    {
                        if (e.innerText == "you clicked me!")
                        {
                            e.innerText = "you double clicked me!";
                            e.css.color = "purple";

                            e.css.setProperty("font-weight", "bold");

                            // Additional information: Duplicate attribute.

                            e.InternalElement.Attribute("special").With(
                                a => a.Remove()
                                );


                            e.InternalElement.Add(
                                new XAttribute("special", "333")
                                );
                        }
                        else
                        {
                            e.innerText = "you clicked me!";
                            e.css.color = "green";
                        }


                        return;
                    }


                    // reload after doubleclick
                    e.Context.__document_location_reload();
                };
            }

            var xx = new TaskCompletionSource <string>();

            xx.SetResult("");
            return(xx.Task);
        }
コード例 #3
0
        public Task Fill()
        {
            // see also
            // X:\jsc.svn\examples\javascript\css\CSSContentDataSource\CSSContentDataSource\Application.cs


            {
                var selector = "[data-column='Column 1']";

                query_setInnerText(
                    selector,
                    new { selector, foo = "bar" }.ToString()
                );
            }

            {
                var x = new QElement { selectorText = "[data-column='Column 2']", Context = this };



                x.innerText = new { x.selectorText, foo = "bar 2" }.ToString();
                x.css.color = "blue";
                x.css.setProperty("text-decoration", "underline");
                x.css.hover.color = "red";

                x.css["[special]"].after.setProperty("content", "' !!! after a secondary click this text will appear by a css rule. the next click will reload the page via the server call'");

                x.onclick +=
                    e =>
                    {
                        if (e.InternalElement.Attribute("special") == null)
                        {
                            if (e.innerText == "you clicked me!")
                            {
                                e.innerText = "you double clicked me!";
                                e.css.color = "purple";

                                e.css.setProperty("font-weight", "bold");

                                // Additional information: Duplicate attribute.

                                e.InternalElement.Attribute("special").With(
                                    a => a.Remove()
                                    );


                                e.InternalElement.Add(
                                    new XAttribute("special", "333")
                                    );
                            }
                            else
                            {
                                e.innerText = "you clicked me!";
                                e.css.color = "green";
                            }


                            return;
                        }


                        // reload after doubleclick
                        e.Context.__document_location_reload();
                    };
            }

            var xx = new TaskCompletionSource<string>();
            xx.SetResult("");
            return xx.Task;

        }
コード例 #4
0
        // }



        //        ILStringConversion Prepare System.Action`2[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]
        //ILStringConversion Prepare System.Action`3[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]
        //ILStringConversion Prepare System.Action`2[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[TestQuerySelectorFromServer.QMethod, TestQuerySelectorFromServer, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]
        //2448:01:01 RewriteToAssembly error: System.ArgumentException: Duplicate type name within an assembly.
        //   at System.Reflection.Emit.TypeBuilder.DefineType(RuntimeModule module, String fullname, Int32 tkParent, TypeAttributes attributes, Int32 tkEnclosingType, Int32[] interfaceTokens)

        public Task __QMethod_Invoke(QMethod qmethod, string selectorText, XElement InternalElement)
        {
            // how will jsc know all the possible inline calls?
            // do we have to do a trace of which methods are callable?
            // basically whoever calls onclick
            // shall be made callable as it calls query_onclick
            // which means it goes to the client
            // its like java throws.
            // this time areound its more [resumable]
            var m = typeof(ApplicationWebService).Assembly.ManifestModule.ResolveMethod(qmethod.MetadataToken);


            var before = InternalElement.ToString();

            var x = new QElement
            {
                selectorText = selectorText,
                Context = this,
                InternalElement = InternalElement,
                InternalElementConstuctor = qmethod
            };



            if (m.IsStatic)
            {
                m.Invoke(null, new[] { x });
            }

            var after = InternalElement.ToString();

            if (before != after)
            {
                this.query_setInternalElement(selectorText, InternalElement);
            }

            var xx = new TaskCompletionSource<string>();
            xx.SetResult("");
            return xx.Task;
        }