Esempio n. 1
0
    ice_invoke_async(Ice.AMD_Object_ice_invoke amdCb, byte[] inEncaps, Ice.Current current)
    {
        bool twoway = current.requestId > 0;

        Ice.ObjectPrx obj = current.con.createProxy(current.id);
        if (!twoway)
        {
            if (_startBatch)
            {
                _startBatch = false;
                _batchProxy = obj.ice_batchOneway();
            }
            if (_batchProxy != null)
            {
                obj = _batchProxy;
            }

            if (current.facet.Length != 0)
            {
                obj = obj.ice_facet(current.facet);
            }

            if (_batchProxy != null)
            {
                byte[] outEncaps;
                obj.ice_invoke(current.operation, current.mode, inEncaps, out outEncaps, current.ctx);
                amdCb.ice_response(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);
            }
        }
        else
        {
            if (current.facet.Length != 0)
            {
                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);
        }
    }