fix: async car update

This commit is contained in:
Frozd
2025-11-28 10:35:59 +01:00
parent dd10745c76
commit 306994542e

View File

@@ -59,17 +59,29 @@ namespace CarManagerV2
car.Price = nudPrice.Value; car.Price = nudPrice.Value;
} }
private void btnSave_Click(object sender, EventArgs e) private async void btnSave_Click(object sender, EventArgs e)
{ {
// save car to cars.csv and close form // save car to cars.csv and close form
//saving car... popuo //saving car... popuo
btnSave.Enabled = false;
btnDelete.Enabled = false;
var msgbox = new PleaseWait(); var msgbox = new PleaseWait();
msgbox.Show(); msgbox.Show();
Application.DoEvents(); Application.DoEvents();
await Task.Run(() =>
{
StateManager.UpdateCar(car); StateManager.UpdateCar(car);
Image fooimg = ImageManager.GetImage(car); });
msgbox.Close(); await Task.Run(() =>
{
ImageManager.GetImage(car);
});
btnSave.Enabled = true;
btnDelete.Enabled = true;
this.Close(); this.Close();
msgbox.Close();
} }