Example #1
0
        private void subscribeEvent()
        {
            if (!bSubscribed)
            {
                var request = new Rpc.Event.Protocol.EventRequest();

                try
                {
                    client.ExecuteAsync(request.toByteArray()).
                    ContinueWith(r =>
                    {
                        this.InvokeIfRequired(() => onEvent(r.Result));
                    });
                }
                catch (RpcException ex)
                {
                    if (RpcError.RPC_S_SERVER_UNAVAILABLE == ex.RpcError || RpcError.RPC_S_SERVER_TOO_BUSY == ex.RpcError)
                    {
                        textBox1.AppendText(String.Format("RPC Server Unavailable, Error={0}\r\n", ex));
                    }
                    else
                    {
                        throw;
                    }
                }

                bSubscribed = true;
            }
        }
Example #2
0
        private void subscribeEvent()
        {
            if (!bSubscribed)
              {
            var request = new Rpc.Event.Protocol.EventRequest();

            try
            {
              client.ExecuteAsync(request.toByteArray()).
            ContinueWith(r =>
            {
              this.InvokeIfRequired(() => onEvent(r.Result));
            });
            }
            catch (RpcException ex)
            {
              if (RpcError.RPC_S_SERVER_UNAVAILABLE == ex.RpcError || RpcError.RPC_S_SERVER_TOO_BUSY == ex.RpcError)
              {
            textBox1.AppendText(String.Format("RPC Server Unavailable, Error={0}\r\n", ex));
              }
              else
              {
            throw;
              }
            }

            bSubscribed = true;
              }
        }