diff options
Diffstat (limited to 'csharp/test/Ice/echo/BlobjectI.cs')
-rw-r--r-- | csharp/test/Ice/echo/BlobjectI.cs | 61 |
1 files changed, 12 insertions, 49 deletions
diff --git a/csharp/test/Ice/echo/BlobjectI.cs b/csharp/test/Ice/echo/BlobjectI.cs index 34800a7a22d..8580dcaa4a3 100644 --- a/csharp/test/Ice/echo/BlobjectI.cs +++ b/csharp/test/Ice/echo/BlobjectI.cs @@ -7,45 +7,11 @@ // // ********************************************************************** -using System; -using System.Collections.Generic; using System.Diagnostics; -using System.Threading; -using Test; +using System.Threading.Tasks; public class BlobjectI : Ice.BlobjectAsync { - - private class Callback - { - public Callback(Ice.AMD_Object_ice_invoke cb, bool twoway) - { - _cb = cb; - _twoway = twoway; - } - - public void response(bool ok, byte[] encaps) - { - _cb.ice_response(ok, encaps); - } - - public void exception(Ice.Exception ex) - { - _cb.ice_exception(ex); - } - - public void sent(bool sync) - { - if(!_twoway) - { - _cb.ice_response(true, new byte[0]); - } - } - - private Ice.AMD_Object_ice_invoke _cb; - private bool _twoway; - } - public void startBatch() { Debug.Assert(_batchProxy != null); @@ -59,8 +25,8 @@ public class BlobjectI : Ice.BlobjectAsync _batchProxy = null; } - public override void - ice_invoke_async(Ice.AMD_Object_ice_invoke amdCb, byte[] inEncaps, Ice.Current current) + public override Task<Ice.Object_Ice_invokeResult> + ice_invokeAsync(byte[] inEncaps, Ice.Current current) { bool twoway = current.requestId > 0; Ice.ObjectPrx obj = current.con.createProxy(current.id); @@ -85,16 +51,14 @@ public class BlobjectI : Ice.BlobjectAsync { byte[] outEncaps; obj.ice_invoke(current.operation, current.mode, inEncaps, out outEncaps, current.ctx); - amdCb.ice_response(true, new byte[0]); + return Task.FromResult(new Ice.Object_Ice_invokeResult(true, new byte[0])); } else { - Callback cb = new Callback(amdCb, false); - obj.ice_oneway().begin_ice_invoke(current.operation, - current.mode, - inEncaps, - current.ctx).whenCompleted(cb.response, cb.exception) - .whenSent(cb.sent); + return obj.ice_oneway().ice_invokeAsync(current.operation, + current.mode, + inEncaps, + current.ctx); } } else @@ -103,11 +67,10 @@ public class BlobjectI : Ice.BlobjectAsync { obj = obj.ice_facet(current.facet); } - Callback cb = new Callback(amdCb, true); - obj.begin_ice_invoke(current.operation, - current.mode, - inEncaps, - current.ctx).whenCompleted(cb.response, cb.exception).whenSent(cb.sent); + return obj.ice_invokeAsync(current.operation, + current.mode, + inEncaps, + current.ctx); } } |