private void GetCSVFile(object sender, RoutedEventArgs e) { try { string txtPath = ""; var dlg = new OpenFileDialog(); //Open the Pop-Up Window to select the file if (dlg.ShowDialog() == true) { new FileInfo(dlg.FileName); using (Stream s = dlg.OpenFile()) { TextReader reader = new StreamReader(s); string st = reader.ReadToEnd(); txtPath = dlg.FileName; Console.WriteLine(txtPath); } } ProcessCSV fileProccessor = new ProcessCSV(txtPath); List <string> unpaidList = fileProccessor.getMembers(); UnpaidMembersGrid.ItemsSource = unpaidList; } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Error checking file"); } }
public async Task OnPostAsync() { //await Upload.CopyToAsync(fileStream); using (var source_file = new StreamReader(Upload.OpenReadStream())) { sql = await ProcessCSV.ProcessAsync(source_file); sql.SSD = SSD; sql.Region = Region; sql.ProcessCounters(); ManagedInstanceMapping mi = new ManagedInstanceMapping(); bf = await mi.FindBestFitAsync(sql); var procmon_chart_obj = sql.GenerateProcmonChartData(); procmonchartdata = JsonSerializer.Serialize(procmon_chart_obj); } }