So i have this method to read from a CSV File and it works.
//Alte Bestand
private void PageLoad_Alt(object sender, RoutedEventArgs e)
{
try
{
//Index von selectedItem
string filepath = directory + "\\" + "ParkingTool_BESTAND.csv";
//CSVHelper Config
var config = new CsvConfiguration(CultureInfo.CurrentCulture) { Delimiter = ";" };
using (var csv = new CsvReader(new StreamReader(filepath), config))
{
csv.Read();
csv.ReadHeader();
while (csv.Read())
{
string barcodeField = csv.GetField<string>("Barcode");
string boxField = csv.GetField<string>("BoxNr");
string datumField = csv.GetField<string>("Datum");
alte_parking_collection.Add(new ParkingClass() { parking_barcode = barcodeField, parking_box = boxField, parking_datum = datumField }); ;
}
}
code_box.Focus();
}
catch (Exception ex)
{
MessageBox.Show("Bitte Datei überprüfen! " + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Warning);
code_box.Focus();
}
}
Then i call it with Loaded += PageLoad_Alt;
when the page starts.
But i want something that calls the method again when a another collection is edited. Any ideas?
parking_collection.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(PageLoad_Alt());
This is not working.