private async Task LoadCsvFileAsync(string fileName) { ProgressBar.Maximum = await CsvService.GetLinesAsync(fileName); var progress = new Progress <int>(async k => await PopulateGridAsync()); progress.ProgressChanged += (sender, i) => { Application.Current.Dispatcher.Invoke(() => { ProgressBar.Value += i; Status.Content = $"Loaded {ProgressBar.Value} from {ProgressBar.Maximum} lines"; }); }; await CsvService.DeleteParticipantsAsync() .ContinueWith(t => CsvService.StoreParticipantsAsync(fileName, progress, _cancellation.Token, blockSize: 10000 ) .ContinueWith(k => PopulateGridAsync())); }
private async void ClearDatabase_OnClick(object sender, RoutedEventArgs e) { await CsvService.DeleteParticipantsAsync() .ContinueWith(t => PopulateGridAsync()); }