Пример #1
0
        public async Task <SomeResponse> GetResponseAsync(Guid testValue)
        {
            var request = new SomeRequest {
                Data = testValue
            };

            SomeResponse response = null;

            var process = new LongRunningProcess();

            var stopwatch = new Stopwatch();

            stopwatch.Start();
            await process.ProcessAsync(request).ContinueWith(task =>
            {
                while (process.Result.Data != request.Data)
                {
                    Task.Delay(1);
                }

                response = process.Result;
                stopwatch.Stop();
                response.Time = stopwatch.Elapsed;
            });


            return(response);
        }
Пример #2
0
        public async Task ProcessAsync(SomeRequest request)
        {
            var response = new SomeResponse {
                Data = request.Data
            };
            await Task.Delay(500);

            Result = response;
        }