Ejemplo n.º 1
0
        public IStreamingCall <string> Stream(HoverRequest request, CancellationToken cancellationToken = default)
        {
            var msg = new HoverReadStreamRequest
            {
                Session     = CreateSession(),
                XFromCenter = checked ((uint)request.XFromCenter),
                YFromCenter = checked ((uint)request.YFromCenter),
            };
            var call         = Client.HoverReadStream(msg, CreateOptions(cancellationToken));
            var loggedParser = LoggedParser <HoverReadStreamResponse, string>(response => response.Text);

            return(new StreamingCall <HoverReadStreamResponse, string>(call, loggedParser));
        }
Ejemplo n.º 2
0
        public Task <string> Query(HoverRequest request, CancellationToken cancellationToken = default)
        {
            var msg = new HoverReadRequest
            {
                Session     = CreateSession(),
                XFromCenter = checked ((uint)request.XFromCenter),
                YFromCenter = checked ((uint)request.YFromCenter),
            };
            Func <Task <HoverReadResponse>, string> continuationFunction = task => task.Result.Text;
            var loggedParser = LoggedParser(continuationFunction);

            return(Client.HoverReadAsync(msg, CreateOptions(cancellationToken)).ResponseAsync
                   .ContinueWith(loggedParser, cancellationToken, TaskContinuationOptions.OnlyOnRanToCompletion,
                                 TaskScheduler.Current));
        }