Mercurial > repos > IBBoard.WarFoundry.GUI.WinForms
comparison FrmMain.cs @ 237:ea5cb50ebe5e
Fixes #384: Validation warnings don't get cleared when creating new armies
* Check whether army is valid when it changes (also means we validate on load as well as clearing on close)
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 21 Jan 2012 16:51:07 +0000 |
parents | c06d0865ff27 |
children | 55c94d438a4b |
comparison
equal
deleted
inserted
replaced
236:dd893a582184 | 237:ea5cb50ebe5e |
---|---|
913 } | 913 } |
914 | 914 |
915 private void FrmMain_ArmyChanged(Army oldArmy, Army newArmy) | 915 private void FrmMain_ArmyChanged(Army oldArmy, Army newArmy) |
916 { | 916 { |
917 CommandStack.Reset(); | 917 CommandStack.Reset(); |
918 ValidateArmy(); | |
918 loadedFilePath = null; | 919 loadedFilePath = null; |
919 miSaveArmy.Enabled = false; | 920 miSaveArmy.Enabled = false; |
920 bttnSaveArmy.Enabled = false; | 921 bttnSaveArmy.Enabled = false; |
921 miEditArmy.Enabled = (CurrentArmy != null); | 922 miEditArmy.Enabled = (CurrentArmy != null); |
922 //TODO: Subscribe to an "army changed" event here | 923 //TODO: Subscribe to an "army changed" event here |
1249 } | 1250 } |
1250 | 1251 |
1251 private void ValidateArmy() | 1252 private void ValidateArmy() |
1252 { | 1253 { |
1253 ICollection<string> failureMessages; | 1254 ICollection<string> failureMessages; |
1254 if (Validates.AsOkay(RequirementHandler.ValidateArmy(CurrentArmy, out failureMessages))) | 1255 if (CurrentArmy == null || Validates.AsOkay(RequirementHandler.ValidateArmy(CurrentArmy, out failureMessages))) |
1255 { | 1256 { |
1256 sbErrorPanel.Text = ""; | 1257 sbErrorPanel.Text = ""; |
1257 sbErrorPanel.Tag = ""; | 1258 sbErrorPanel.Tag = ""; |
1258 } | 1259 } |
1259 else | 1260 else |