private void LoadVcfDirectory(string filename) { List <WabContact> wabContacts = new List <WabContact>(20); bool error = false; var files = Directory.GetFiles(filename, "*.vcf"); foreach (var file in files) { try { var wc = WabIO.ReadVcard(file); wabContacts.AddRange(wc); } catch (Exception) { error = true; } } if (error) { MessageBox.Show(this, "Es konnten nicht alle Daten gelesen werden!", App.PROGRAM_NAME, MessageBoxButton.OK, MessageBoxImage.Error); } InitData(filename, wabContacts); }
private void LoadFile(string filename) { WabContact[] wabContacts; if (Path.GetExtension(filename) == ".csv") { wabContacts = WabIO.ReadCsv(filename); } else { wabContacts = WabIO.ReadVcard(filename); } InitData(filename, wabContacts); }