Ejemplo n.º 1
0
        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()));
        }
Ejemplo n.º 2
0
 private async void ClearDatabase_OnClick(object sender, RoutedEventArgs e)
 {
     await CsvService.DeleteParticipantsAsync()
     .ContinueWith(t => PopulateGridAsync());
 }