I am trying to execute an action in the background without freezing the user interface.
Of course, I could use BackgroundWorker for this.
However, I would like to do this only using task APIs.
I tried:
async void OnTestLoaded(object sender, RoutedEventArgs e) { await LongOperation(); }
and
async void OnTestLoaded(object sender, RoutedEventArgs e) { var task = Task.Run(()=> LongOperation()); task.Wait(); }
So should I go back to BackgroundWorker? Or is there a solution that uses only Tasks?
source share