public async Task <ActionResult> AsyncCalculate(CalculationLogModel model)
        {
            var threadId = Thread.CurrentThread.ManagedThreadId;
            var x        = model.Number;

            var log = await _service.AsyncCalculate(x);

            return(View("Index", new CalculationLogModel(log, model.Number, "Asynchronous calculation", threadId)));
        }
示例#2
0
        private async void ASyncButton_Click(object sender, EventArgs e)
        {
            var n = ++_count;

            LogStart(AsyncButton.Text, n);

            var log = await _service.AsyncCalculate(Convert.ToInt32(NumberTextBox.Text));

            LogEnd(AsyncButton.Text, log, n);
        }