Convenience: If creating a new ship fails, the ship is shown again when the dialog is re-opened
This commit is contained in:
parent
65779731fd
commit
b154f73ce9
@ -1065,7 +1065,7 @@ namespace BreCalClient
|
||||
// (if the special-flag is enabled). Assigned Agency: ShipcallParticipantMap(id=628, shipcall_id=115, participant_id=10,
|
||||
// type=8, created=datetime.datetime(2024, 8, 28, 15, 13, 14), modified=None) with Flags: 42\"}
|
||||
Match m = Regex.Match(message, "\\{(.*)\\}");
|
||||
if ((m != null) && (m.Success))
|
||||
if ((m != null) && m.Success)
|
||||
{
|
||||
dynamic? msg = JsonConvert.DeserializeObject(m.Value);
|
||||
if(msg != null)
|
||||
|
||||
@ -90,7 +90,9 @@ namespace BreCalClient
|
||||
|
||||
private async void DataGridShips_CreateRequested()
|
||||
{
|
||||
ShipModel shipModel = new(new Ship());
|
||||
|
||||
ShipModel shipModel = new((ShipModel.LastEditShip != null) ? ShipModel.LastEditShip : new Ship());
|
||||
|
||||
EditShipDialog esd = new()
|
||||
{
|
||||
Ship = shipModel.Ship
|
||||
@ -111,14 +113,15 @@ namespace BreCalClient
|
||||
if(!BreCalLists.ShipLookupDict.TryAdd(id.VarId, shipModel))
|
||||
BreCalLists.ShipLookupDict[id.VarId] = shipModel;
|
||||
this.dataGridShips.ItemsSource = BreCalLists.AllShips;
|
||||
ShipModel.LastEditShip = null;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ShipModel.LastEditShip = shipModel.Ship;
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@ -16,6 +16,8 @@ namespace BreCalClient
|
||||
|
||||
public Ship Ship { get; private set; }
|
||||
|
||||
public static Ship? LastEditShip { get; set; }
|
||||
|
||||
public string TugCompany
|
||||
{
|
||||
get { if(this.Ship.ParticipantId.HasValue)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user