Don't crash on ship delete API error
This commit is contained in:
parent
8028382e79
commit
93362d3695
@ -49,8 +49,15 @@ namespace BreCalClient
|
|||||||
{
|
{
|
||||||
if (!shipmodel.Ship.Deleted)
|
if (!shipmodel.Ship.Deleted)
|
||||||
{
|
{
|
||||||
if (this.ShipApi != null)
|
try
|
||||||
await this.ShipApi.ShipDeleteAsync(shipmodel.Ship.Id);
|
{
|
||||||
|
if (this.ShipApi != null)
|
||||||
|
await this.ShipApi.ShipDeleteAsync(shipmodel.Ship.Id);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
|
}
|
||||||
BreCalLists.Ships.Remove(shipmodel); // remove from "selectable" ships
|
BreCalLists.Ships.Remove(shipmodel); // remove from "selectable" ships
|
||||||
shipmodel.Ship.Deleted = true; // set deleted marker on working instance
|
shipmodel.Ship.Deleted = true; // set deleted marker on working instance
|
||||||
this.dataGridShips.ItemsSource = null;
|
this.dataGridShips.ItemsSource = null;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user