Пример #1
0
        private async void loadFile_Click(object sender, RoutedEventArgs e)
        {
            FileOpenPicker openPicker = new FileOpenPicker {
                SuggestedStartLocation = PickerLocationId.DocumentsLibrary, ViewMode = PickerViewMode.Thumbnail
            };

            openPicker.FileTypeFilter.Add(".csv");
            openPicker.FileTypeFilter.Add(".txt");
            StorageFile file = await openPicker.PickSingleFileAsync();

            if (file == null)
            {
                return;
            }
            string text = await FileIO.ReadTextAsync(file);

            if (this.summaryTextBox.Text == "Summary")
            {
                CovidCsvParser parser = new CovidCsvParser();
                this.currentStatistics = parser.ParseText(text).ToList();
                this.errorsFound       = parser.Errors.ToList();
                this.setCovidDataToSummaryBox();
            }
            else
            {
                this.incomingStatistics.Clear();
                this.duplicatesFound.Clear();
                CovidCsvParser parser = new CovidCsvParser();
                this.incomingStatistics = parser.ParseText(text).ToList();
                this.errorsFound        = parser.Errors.ToList();
                this.displayMergeOption();
            }
        }