private async Task <bool> SearchUploadedUsers(CSVPerson person, IList <IDictionary <string, object> > data) { return(await Task.Run(() => { foreach (var item in data) { if (person.UserName == item["username"].ToString()) { person.ID = int.Parse(item["id"].ToString()); return true; } } return false; })); }
private void browse_btn_Click(object sender, EventArgs e) { using (var fbd = new OpenFileDialog()) { fbd.Multiselect = false; fbd.ValidateNames = true; fbd.Filter = "CSV files (*.csv)|*.csv"; DialogResult result = fbd.ShowDialog(); if (result == DialogResult.OK && !string.IsNullOrWhiteSpace(fbd.FileName)) { path_txt.Text = fbd.FileName; List <Dictionary <string, string> > Students = ParseCSVFile(fbd.FileName); CSVPerson csvPerson; flowLayoutPanel.Controls.Clear(); foreach (Dictionary <string, string> item in Students) { csvPerson = new CSVPerson(item); flowLayoutPanel.Controls.Add(csvPerson); csvPerson.Checked = true; } } } }