Ejemplo n.º 1
0
        void async_call()
        {
            RpcPromise p = new RpcPromise();

            p.then(_ => {
                prx.echo_async("this is a sync text",
                               delegate(string result, RpcAsyncContext ctx) {
                    Console.WriteLine("echo() result:" + result);
                    ctx.promise.data = result;
                    ctx.onNext();
                    //ctx.again();
                }, _.promise);
            }).then(_ => {
                prx.timeout_async(1, delegate(RpcAsyncContext ctx) {
                    Console.WriteLine("timeout completed!");
                    ctx.onNext();
                }, _.promise);
            });
            RpcPromise pe = p.error(_ => {
                Console.WriteLine("async call error:" + _.exception.ToString());
                _.onNext();
            });

            p.final(_ => {
                Console.WriteLine(" commands be executed completed!");
            });
            p.end();
        }