WPF asynchronous Task<T> blocking UI
问题 I already worked with Task type. And all was good while Task return nothing. For example: XAML: <Button Name="_button" Click="ButtonBase_OnClick"> Click </Button> CodeBehind: private void ButtonBase_OnClick(object sender, RoutedEventArgs e) { _button.IsEnabled = false; Task.Factory.StartNew(() => { Thread.Sleep(5*1000); Dispatcher.Invoke(new Action(() => _button.IsEnabled = true)); }); } This works fine. But I want to Task returns some value, for example Boolean . So I need to use Task