Exemplo n.º 1
0
        static public async Task <InputCsvData> CreateInstanceAsync(StorageFile inputFile)
        {
            InputCsvData csvData = new InputCsvData(inputFile);
            await csvData.StartParsingAsync();

            return(csvData);
        }
Exemplo n.º 2
0
        private async void SaveCsvBasingOnInputCsv(StorageFile csvFile, InputCsvData inputCsvData)
        {
            using (CsvFileWriter csvWriter = new CsvFileWriter(await csvFile.OpenStreamForWriteAsync()))
            {
                List <CsvRow> copiedRows = inputCsvData.GetCopiedDataRows();
                SetCoordinate(copiedRows);

                foreach (var row in copiedRows)
                {
                    csvWriter.WriteRow(row);
                }

                csvWriter.Close();
            }
        }
Exemplo n.º 3
0
        private async void LoadCSVButton_Click(object sender, RoutedEventArgs e)
        {
            FileOpenPicker fileOpenPicker = new FileOpenPicker();

            fileOpenPicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
            fileOpenPicker.FileTypeFilter.Add(".csv");
            fileOpenPicker.ViewMode = PickerViewMode.Thumbnail;

            var csvFile = await fileOpenPicker.PickSingleFileAsync();

            if (csvFile == null)
            {
                return;
            }

            gInputCsvData = await InputCsvData.CreateInstanceAsync(csvFile);

            LoadCSVPathTextBlock.Text = csvFile.Path;
        }