fix: async car update
This commit is contained in:
@@ -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();
|
||||||
StateManager.UpdateCar(car);
|
await Task.Run(() =>
|
||||||
Image fooimg = ImageManager.GetImage(car);
|
{
|
||||||
msgbox.Close();
|
StateManager.UpdateCar(car);
|
||||||
|
});
|
||||||
|
await Task.Run(() =>
|
||||||
|
{
|
||||||
|
ImageManager.GetImage(car);
|
||||||
|
});
|
||||||
|
btnSave.Enabled = true;
|
||||||
|
btnDelete.Enabled = true;
|
||||||
this.Close();
|
this.Close();
|
||||||
|
msgbox.Close();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user