示例#1
0
        private void button2_Click(object sender, EventArgs e)
        {
            var a = new ApplicationWebService();

            a.WebMethod4(button2.Text, x => button2.Text = x);

            MessageBox.Show("All done, Sir!");
        }
示例#2
0
        async private void button4_Click(object sender, EventArgs e)
        {
            var a = new ApplicationWebService();

            var i = await a.WebMethod16(button3.Text, x => button3.Text = x);

            // see! i is int!
            MessageBox.Show(i + "\n\n All done, Sir!");
        }
示例#3
0
        private static void InternalTry()
        {
            try
            {
                Expression<Func<Book1Sheet1Row, bool>> where =
                    //x => x.Foo == "xxx";
                    x => string.Equals(x.Foo, "xxx");


                var w = new ApplicationWebService();

                w.WebMethod2();

                // X:\jsc.svn\core\ScriptCoreLib\JavaScript\DOM\CSS\CSSStyleSheet.cs

                //X:\jsc.svn\examples\java\JVMCLRIQueryable\JVMCLRIQueryable\bin\Release>JVMCLRIQueryable.exe
                //java.lang.Object, rt

                //error: { Target = class ScriptCoreLibJava.BCLImplementation.System.__String, MethodName = op_Equality }

                //error: { Parameter = class ScriptCoreLibJava.BCLImplementation.System.__String }
                //error: { Parameter = class ScriptCoreLibJava.BCLImplementation.System.__String }
                //error: { Method = java.lang.String Concat([Ljava.lang.Object;) }
                //error: { Method = java.lang.String Concat(java.lang.Object, java.lang.Object) }
                //error: { Method = java.lang.String Concat(java.lang.String, java.lang.String) }
                //error: { Method = java.lang.String Concat(java.lang.Object) }
                //error: { Method = java.lang.String Concat([Ljava.lang.String;) }
                //error: { Method = java.lang.String Concat(java.lang.Object, java.lang.Object, java.lang.Object) }
                //error: { Method = java.lang.String Concat(java.lang.String, java.lang.String, java.lang.String, java.lang.String) }
                //error: { Method = java.lang.String Concat(java.lang.String, java.lang.String, java.lang.String) }
                //error: { Method = java.lang.String Replace(java.lang.String, java.lang.String, java.lang.String) }
                //error: { Method = boolean op_Inequality(java.lang.String, java.lang.String) }
                //error: { Method = java.lang.String InternalConstructor(char, int) }
                //error: { Method = java.lang.String InternalConstructor([C) }
                //error: { Method = [Ljava.lang.String; SplitStringByChar(java.lang.String, char) }
                //error: { Method = boolean Equals_060002fb(java.lang.String, java.lang.String) }
                //error: { Method = [Ljava.lang.String; Split(java.lang.String, [Ljava.lang.String;, int) }
                //error: { Method = [Ljava.lang.String; Split(java.lang.String, [C) }
                //error: { Method = java.lang.String Substring(java.lang.String, int, int) }
                //error: { Method = boolean IsNullOrEmpty(java.lang.String) }
                //error: { Method = java.lang.String PadLeft(java.lang.String, int) }
                //error: { Method = java.lang.String PadLeft(java.lang.String, int, char) }
                //error: { Method = boolean Contains(java.lang.String, java.lang.String) }
                //error: { Method = [C ToCharArray(java.lang.String) }


            }
            catch (Exception ex)
            {
                Console.WriteLine(
                    new { ex.Message, ex.StackTrace }
                    );
            }
        }
示例#4
0
        private static void InternalTry()
        {
            try
            {
                Expression <Func <Book1Sheet1Row, bool> > where =
                    //x => x.Foo == "xxx";
                    x => string.Equals(x.Foo, "xxx");


                var w = new ApplicationWebService();

                w.WebMethod2();

                // X:\jsc.svn\core\ScriptCoreLib\JavaScript\DOM\CSS\CSSStyleSheet.cs

                //X:\jsc.svn\examples\java\JVMCLRIQueryable\JVMCLRIQueryable\bin\Release>JVMCLRIQueryable.exe
                //java.lang.Object, rt

                //error: { Target = class ScriptCoreLibJava.BCLImplementation.System.__String, MethodName = op_Equality }

                //error: { Parameter = class ScriptCoreLibJava.BCLImplementation.System.__String }
                //error: { Parameter = class ScriptCoreLibJava.BCLImplementation.System.__String }
                //error: { Method = java.lang.String Concat([Ljava.lang.Object;) }
                //error: { Method = java.lang.String Concat(java.lang.Object, java.lang.Object) }
                //error: { Method = java.lang.String Concat(java.lang.String, java.lang.String) }
                //error: { Method = java.lang.String Concat(java.lang.Object) }
                //error: { Method = java.lang.String Concat([Ljava.lang.String;) }
                //error: { Method = java.lang.String Concat(java.lang.Object, java.lang.Object, java.lang.Object) }
                //error: { Method = java.lang.String Concat(java.lang.String, java.lang.String, java.lang.String, java.lang.String) }
                //error: { Method = java.lang.String Concat(java.lang.String, java.lang.String, java.lang.String) }
                //error: { Method = java.lang.String Replace(java.lang.String, java.lang.String, java.lang.String) }
                //error: { Method = boolean op_Inequality(java.lang.String, java.lang.String) }
                //error: { Method = java.lang.String InternalConstructor(char, int) }
                //error: { Method = java.lang.String InternalConstructor([C) }
                //error: { Method = [Ljava.lang.String; SplitStringByChar(java.lang.String, char) }
                //error: { Method = boolean Equals_060002fb(java.lang.String, java.lang.String) }
                //error: { Method = [Ljava.lang.String; Split(java.lang.String, [Ljava.lang.String;, int) }
                //error: { Method = [Ljava.lang.String; Split(java.lang.String, [C) }
                //error: { Method = java.lang.String Substring(java.lang.String, int, int) }
                //error: { Method = boolean IsNullOrEmpty(java.lang.String) }
                //error: { Method = java.lang.String PadLeft(java.lang.String, int) }
                //error: { Method = java.lang.String PadLeft(java.lang.String, int, char) }
                //error: { Method = boolean Contains(java.lang.String, java.lang.String) }
                //error: { Method = [C ToCharArray(java.lang.String) }
            }
            catch (Exception ex)
            {
                Console.WriteLine(
                    new { ex.Message, ex.StackTrace }
                    );
            }
        }
示例#5
0
        async private void button3_Click(object sender, EventArgs e)
        {
            var a = new ApplicationWebService();


//2>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1546,5):
            //warning MSB3270: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "Z:\jsc.svn\examples\javascript\Test\TestAsyncFeatures\TestAsyncFeatures\bin\Debug\TestAsyncFeatures.exe", "x86". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.
//2>Z:\jsc.svn\examples\javascript\Test\TestAsyncFeatures\ClientSideForms\Form1.cs(51,13,51,68):
            //error CS4001: Cannot await 'void'
//2>Z:\jsc.svn\examples\javascript\Test\TestAsyncFeatures\ClientSideForms\Form1.cs(58,13,58,68):
            //error CS4033: The 'await' operator can only be used within an async method.
            //Consider marking this method with the 'async' modifier and changing its return type to 'Task'.


            await a.WebMethod8(button3.Text, x => button3.Text = x);

            MessageBox.Show("All done, Sir!");
        }
        public WebServiceCollection(WebServiceContext ctx)
        {
            if (ctx == null)
            {
                throw new ArgumentNullException(nameof(ctx));
            }

            _ctx = ctx;

            _services = new List <BaseWebService>();
            _hosts    = new List <ServiceHost>();

            _applicationService    = new ApplicationWebService(_ctx);
            _authenticationService = new AuthenticationWebService(_ctx);
            _relationshipService   = new RelationshipWebService(_ctx);
            _userService           = new UserWebService(_ctx);
            _shopService           = new ShopWebService(_ctx);

            _services.Add(_applicationService);
            _services.Add(_authenticationService);
            _services.Add(_relationshipService);
            _services.Add(_userService);
            _services.Add(_shopService);
        }
        public Application(IApp page)
        {
            // per iframe there is one only.
            // we should be respawning async state this pointer while jmping into iframe.
            __base = this;

            #region  magic
            var isroot = Native.window.parent == Native.window.self;

            //new IHTMLPre { new { isroot } }.AttachToDocument();

            if (!isroot)
            {
                #region HopToParent
                HopToParent.VirtualOnCompleted = async (that, continuation) =>
                {
                    // the state is in a member variable?

                    var r = TestSwitchToServiceContextAsync.ShadowIAsyncStateMachine.ResumeableFromContinuation(continuation);

                    // should not be a zero state
                    // or do we have statemachine name clash?

                    //new IHTMLPre {
                    //    "iframe about to jump to parent " + new { r.shadowstate.state }
                    //}.AttachToDocument();

                    Native.window.parent.postMessage(r.shadowstate);

                    // we actually wont use the response yet..
                };
                #endregion


                // start the handshake
                // we gain intellisense, but the type is partal, likely not respawned, acivated, initialized 

                //  new IHTMLPre {
                //  "inside iframe awaiting state"
                //}.AttachToDocument();




                var c = new MessageChannel();

                c.port1.onmessage +=
                    m =>
                    {
                        var that = (TestSwitchToServiceContextAsync.ShadowIAsyncStateMachine)m.data;

                        //new IHTMLPre {
                        //            "inside iframe got state " +
                        //            new { that.state }
                        //      }.AttachToDocument();

                        // about to invoke

                        #region xAsyncStateMachineType
                        var xAsyncStateMachineType = typeof(Application).Assembly.GetTypes().FirstOrDefault(
                              item =>
                              {
                                  // safety check 1

                                  //Console.WriteLine(new { sw.ElapsedMilliseconds, item.FullName });

                                  var xisIAsyncStateMachine = typeof(IAsyncStateMachine).IsAssignableFrom(item);
                                  if (xisIAsyncStateMachine)
                                  {
                                      //Console.WriteLine(new { item.FullName, isIAsyncStateMachine });

                                      return item.FullName == that.TypeName;
                                  }

                                  return false;
                              }
                          );
                        #endregion


                        var NewStateMachine = FormatterServices.GetUninitializedObject(xAsyncStateMachineType);
                        var isIAsyncStateMachine = NewStateMachine is IAsyncStateMachine;

                        var NewStateMachineI = (IAsyncStateMachine)NewStateMachine;

                        #region 1__state
                        xAsyncStateMachineType.GetFields(
                                    System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance
                                ).WithEach(
                                 AsyncStateMachineSourceField =>
                                 {

                                     Console.WriteLine(new { AsyncStateMachineSourceField });

                                     if (AsyncStateMachineSourceField.Name.EndsWith("1__state"))
                                     {
                                         AsyncStateMachineSourceField.SetValue(
                                             NewStateMachineI,
                                             that.state
                                          );
                                     }

                                     var xStringField = that.StringFields.AsEnumerable().FirstOrDefault(
                                         f => DecoratedString(f.FieldName) == DecoratedString(AsyncStateMachineSourceField.Name)
                                     );

                                     if (xStringField != null)
                                     {
                                         // once we are to go back to client. we need to reverse it?

                                         AsyncStateMachineSourceField.SetValue(
                                             NewStateMachineI,
                                             xStringField.value
                                          );
                                         // next xml?
                                         // before lets send our strings back with the new state!
                                         // what about exceptions?
                                     }
                                 }
                            );
                        #endregion

                        //new IHTMLPre {
                        //        "inside iframe invoke state"
                        //    }.AttachToDocument();

                        NewStateMachineI.MoveNext();

                        // we can now send one hop back?
                    };

                c.port1.start();
                c.port2.start();

                Native.window.parent.postMessage(null,
                    "*",
                    c.port2
                );





                return;
            }

            var lookup = new Dictionary<IHTMLIFrame, MessageEvent> { };

            #region HopToIFrame
            HopToIFrame.VirtualOnCompleted = async (that, continuation) =>
            {
                var m = default(MessageEvent);
                var r = TestSwitchToServiceContextAsync.ShadowIAsyncStateMachine.ResumeableFromContinuation(continuation);

                if (lookup.ContainsKey(that.frame))
                {
                    //    new IHTMLPre {
                    //    "parent already nows the iframe..."
                    //}.AttachToDocument();

                    m = lookup[that.frame];

                }
                else
                {
                    //    new IHTMLPre {
                    //    "parent is awaiting handshake of the newly loaded iframe..."
                    //}.AttachToDocument();


                    // X:\jsc.svn\examples\javascript\Test\TestSwitchToIFrame\TestSwitchToIFrame\Application.cs
                    //var m = await that.frame.contentWindow.async.onmessage;
                    m = await that.frame.async.onmessage;

                    lookup[that.frame] = m;



                    #region onmessage
                    that.frame.ownerDocument.defaultView.onmessage +=
                        e =>
                        {
                            if (e.source != that.frame.contentWindow)
                                return;

                            var shadowstate = (TestSwitchToServiceContextAsync.ShadowIAsyncStateMachine)e.data;

                            // are we jumping into a new statemachine?

                            //      new IHTMLPre {
                            //      "parent saw iframe instructions to jump back " + new { shadowstate.state }
                            //}.AttachToDocument();

                            // about to invoke

                            #region xAsyncStateMachineType
                            var xAsyncStateMachineType = typeof(Application).Assembly.GetTypes().FirstOrDefault(
                                  item =>
                                  {
                                      // safety check 1

                                      //Console.WriteLine(new { sw.ElapsedMilliseconds, item.FullName });

                                      var xisIAsyncStateMachine = typeof(IAsyncStateMachine).IsAssignableFrom(item);
                                      if (xisIAsyncStateMachine)
                                      {
                                          //Console.WriteLine(new { item.FullName, isIAsyncStateMachine });

                                          return item.FullName == shadowstate.TypeName;
                                      }

                                      return false;
                                  }
                              );
                            #endregion


                            var NewStateMachine = FormatterServices.GetUninitializedObject(xAsyncStateMachineType);
                            var isIAsyncStateMachine = NewStateMachine is IAsyncStateMachine;

                            var NewStateMachineI = (IAsyncStateMachine)NewStateMachine;

                            #region 1__state
                            xAsyncStateMachineType.GetFields(
                                        System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance
                                    ).WithEach(
                                     AsyncStateMachineSourceField =>
                                     {

                                         Console.WriteLine(new { AsyncStateMachineSourceField });

                                         if (AsyncStateMachineSourceField.Name.EndsWith("1__state"))
                                         {
                                             AsyncStateMachineSourceField.SetValue(
                                                 NewStateMachineI,
                                                 shadowstate.state
                                              );
                                         }

                                         var xStringField = shadowstate.StringFields.AsEnumerable().FirstOrDefault(
                                               f => DecoratedString(f.FieldName) == DecoratedString(AsyncStateMachineSourceField.Name)
                                           );

                                         if (xStringField != null)
                                         {
                                             // once we are to go back to client. we need to reverse it?

                                             AsyncStateMachineSourceField.SetValue(
                                                 NewStateMachineI,
                                                 xStringField.value
                                              );
                                             // next xml?
                                             // before lets send our strings back with the new state!
                                             // what about exceptions?
                                         }
                                     }
                                );
                            #endregion

                            //      new IHTMLPre {
                            //      "parent saw iframe instructions to jump back. invoking... "
                            //}.AttachToDocument();

                            NewStateMachineI.MoveNext();

                        };
                    #endregion

                }




                //new IHTMLPre {
                //    "parent is sending state after handshake..."
                //}.AttachToDocument();


                m.postMessage(r.shadowstate);
            };
            #endregion


            #endregion



            // can we log in via MID?
            // where is the last test?
            // Z:\jsc.svn\examples\javascript\crypto\VerifyIdentityAffinity\VerifyIdentityAffinity\Application.cs

            // can we modify roslyn to compile comments into IL?
            new IHTMLPre { "guest, EID, MID. which are we?" }.AttachToDocument();
            new IHTMLPre { new { Native.document.location.protocol, Native.document.location.host } }.AttachToDocument();
            // NFC ?
            new IHTMLPre { new { Native.window.navigator.userAgent } }.AttachToDocument();

            var hostname = Native.document.location.host.TakeUntilIfAny(":");
            var hostport = Native.document.location.host.SkipUntilOrEmpty(":");

            if (string.IsNullOrEmpty(hostport))
                hostport = "443";


            new IHTMLPre { new { base.identity, hostname, hostport } }.AttachToDocument();

            // { identity = { value = guest, signature = 70d1638ccb1627209f7d5751b989dd5cc399ff17c72aff075f2e05ff1b3c9a1f474cf5813c6470b8e9ee77b5911316acee62c6bf3534b2bc4942bc9de4344fc9 } }

            // doesnt jsc assetslibary do public key?
            // should we want to validate the identity on client?
            // can we? if we run on http we cant.


            #region EID
            new IHTMLButton { "EID" }.AttachToDocument().With(
                async e =>
                {
                    #region statemachine fixup?
                    await Task.CompletedTask;
                    #endregion

                    // are we running nfc web browser?
                    if (Native.window.navigator.userAgent.Contains("NFCDID"))
                        e.innerText = "NFC DID";


                    // NFC ?
                    await e.async.onclick;

                    Native.document.body.Clear();

                    // https://technet.microsoft.com/en-us/library/dd979547(v=ws.10).aspx
                    new IHTMLPre { e.innerText + " - Please insert smart card..." }.AttachToDocument();

                    // need hopping support.

                    var hostport1 = Convert.ToInt32(hostport) + 1;
                    var host1 = hostname + ":" + hostport1;
                    var baseURI1 = "https://" + host1;

                    iframe = new IHTMLIFrame { src = baseURI1, frameBorder = "0" }.AttachToDocument();

                    // if the iframe is on another port, ssl client certificate may be prompted
                    //await (HopTo)iframe;
                    await (HopToIFrame)iframe;

                    // ding ding ding.

                    //new IHTMLPre { "hello __base?" }.AttachToDocument();



                    //var xidenity_value = base.identity.value;
                    //var xidenity_signature = base.identity.signature;

                    var xidenity_value = __base.identity.value;
                    //var xidenity_signature = __base.identity.signature;

                    // jsc wont do byte array jumps yet?
                    var xidenity_signature = Convert.ToBase64String(__base.identity.signature);


                    await default(HopToParent);

                    //new IHTMLPre { new { xidenity_value, xidenity_signature, base.identity } }.AttachToDocument();
                    //new IHTMLPre { new { xidenity_value, xidenity_signature, __base.identity } }.AttachToDocument();


                    __base.identity = new VerifiableString
                    {
                        value = xidenity_value,
                        signature = Convert.FromBase64String(xidenity_signature)
                    };

                    __base.foo = "bar";

                    Native.document.body.Clear();
                    new IHTMLPre { new { __base.identity, __base.foo } }.AttachToDocument();

                    // IE cant verify?

                    // verify our new identity.

                    await new IHTMLButton { "Verify" }.AttachToDocument().async.onclick;
                    Native.document.body.style.backgroundColor = "yellow";
                    if (await __base.Verify())
                        Native.document.body.style.backgroundColor = "cyan";
                    else
                        Native.document.body.style.backgroundColor = "red";


                    //await new IHTMLButton { "close" }.AttachToDocument().async.onclick;

                    //// cant close?
                    //Native.window.close();
                }
            );
#endregion

            new IHTMLButton { "MID" }.AttachToDocument().With(
              async e =>
              {
                  await e.async.onclick;

                  Native.document.body.Clear();

                  new IHTMLPre { "MID login..." }.AttachToDocument();

                  var state = await base.MobileAuthenticateAsync15();

                  if (state == null)
                  {
                      new IHTMLPre { "fault" }.AttachToDocument();
                      return;
                  }

                  new IHTMLPre { new { state.MobileAuthenticateAsync15_UserIDCode } }.AttachToDocument();
                  new IHTMLPre { new { state.MobileAuthenticateAsync15_Sesscode } }.AttachToDocument();
                  new IHTMLPre { new { state.MobileAuthenticateAsync15_ChallengeID } }.AttachToDocument();

                  new IHTMLCenter { state.MobileAuthenticateAsync15_ChallengeID.value }.AttachToDocument();

                  var sw = Stopwatch.StartNew();

                  //new IHTMLPre { base.MobileAuthenticateAsync15_ChallengeID, () => new { sw.ElapsedMilliseconds } }.AttachToDocument();
                  //using (new IHTMLPre { () => new { sw.ElapsedMilliseconds } }.AttachToDocument())
                  var u = (new IHTMLPre { () => new { sw.ElapsedMilliseconds } }.AttachToDocument());
                  {
                      await Task.Delay(15000);
                      sw.Stop();
                  }
                  u.Dispose();

                  Native.document.documentElement.style.borderLeft = "2px solid yellow";

                  await base.MobileAuthenticateAsync15Continue(state);

                  // { identity = { value = 14212128025, signature = 818a158d2497c54e9bde7cc7ee498b264282b709a87394be7037c09a7e38d57d515d34fa3cd7a93e8487bd477e4bd20d3f6bfbdce3c07926a1ede5935b6e5d3e } }

                  Native.document.body.Clear();
                  new IHTMLPre { new { base.identity } }.AttachToDocument();

                  await new IHTMLButton { "Verify" }.AttachToDocument().async.onclick;
                  Native.document.body.style.backgroundColor = "yellow";
                  if (await __base.Verify())
                      Native.document.body.style.backgroundColor = "cyan";
                  else
                      Native.document.body.style.backgroundColor = "red";
              }
          );
        }
示例#8
0
 public AbstractWSProvider(IntegrationAdapter pAdapterMetadata, ApplicationWebService pApplicationWebServiceMetadata, IAppRuntime pAppRuntime)
     : base(pAdapterMetadata, pAppRuntime)
 {
     this.ApplicationWebServiceMetadata = pApplicationWebServiceMetadata;
 }
示例#9
0
 public WincashAdapter(IntegrationAdapter pAdapterMetadata, ApplicationWebService pApplicationWebServiceMetadata, IAppRuntime pAppRuntime)
     : base(pAdapterMetadata, pApplicationWebServiceMetadata, pAppRuntime)
 {
 }