diff --git a/TeensyFlasher/frmMain.cs b/TeensyFlasher/frmMain.cs index 144217c..e54c926 100644 --- a/TeensyFlasher/frmMain.cs +++ b/TeensyFlasher/frmMain.cs @@ -69,10 +69,15 @@ void LogMessage(string Text) } void UpdateFirmwareBox() { - foreach (var line in File.ReadAllLines(localCSV)) + lbFirmware.DataSource = null; + teensyFirmwareItems.Clear(); + if (File.Exists(localCSV)) { - var parts = line.Split(','); - teensyFirmwareItems.Add(new TeensyFirmwareItem(parts[0], parts[1])); + foreach (var line in File.ReadAllLines(localCSV)) + { + var parts = line.Split(','); + teensyFirmwareItems.Add(new TeensyFirmwareItem(parts[0], parts[1])); + } } var hexFiles = Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory, "*.hex"); foreach (var hexFile in hexFiles) @@ -86,6 +91,7 @@ void UpdateFirmwareBox() lbFirmware.DisplayMember = "DisplayText"; lbFirmware.ValueMember = "Location"; lbFirmware.SelectedIndex = -1; + lbFirmware.Refresh(); // add any *.hex files in current folder to the list } @@ -99,10 +105,7 @@ public frmMain() lbTeensies.Items.Add(teensy); } if (lbTeensies.Items.Count > 0) lbTeensies.SelectedIndex = 0; - if (File.Exists(localCSV)) - { - UpdateFirmwareBox(); - } + UpdateFirmwareBox(); } private void ConnectedTeensiesChanged(object sender, NotifyCollectionChangedEventArgs e) @@ -161,7 +164,7 @@ bool DownloadFile(string url, string localFile) } private void btnRefreshTeensy_Click(object sender, EventArgs e) { - string url = "https://raw.githubusercontent.com/lansalot/AOGConfigOMatic/main/Firmwares.csv"; + string url = "https://raw.githubusercontent.com/lansalot/AOGConfigOMatic/main/TeensyFlasher/Firmwares.csv"; DownloadFile(url, localCSV); UpdateFirmwareBox(); }