public async Task ExportResultsAsync(ExportFormat format) { if (IsBusy) { return; } IsBusy = true; try { var fileName = _shell.SelectedWriteFile("Select the exported file", "CSV files (*.csv)|*.csv|All files (*.*)|*.*", ".csv"); if (string.IsNullOrWhiteSpace(fileName)) { return; } var results = TestResults.Select(r => r.Result).ToList(); using (var stream = System.IO.File.Create(fileName)) { await Task.Run(() => { _engine.ExportTests(results, stream, format); }); } } finally { IsBusy = false; } }