Example #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);
        }
        // }



        //        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;
        }