changeset 197:10ba2c5340b2

Re #343: Show unit requirement failures * Rework existing dialog box to use new messages
author IBBoard <dev@ibboard.co.uk>
date Sun, 01 May 2011 15:21:13 +0000
parents 15148d255e50
children 417d3f75a752
files FrmMain.cs
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/FrmMain.cs	Sun May 01 11:05:29 2011 +0000
+++ b/FrmMain.cs	Sun May 01 15:21:13 2011 +0000
@@ -1221,15 +1221,16 @@
 
         private void ValidateArmy()
         {
-            if (Validates.AsOkay(RequirementHandler.ValidateArmy(CurrentArmy)))
+            ICollection<string> failureMessages;
+            if (Validates.AsOkay(RequirementHandler.ValidateArmy(CurrentArmy, out failureMessages)))
             {
                 sbErrorPanel.Text = "";
                 sbErrorPanel.Tag = "";
             }
             else
             {
-                sbErrorPanel.Text = "Validation errors exist";
-                sbErrorPanel.Tag = "One or more army requirements have not been met";
+                sbErrorPanel.Text = failureMessages.Count + " validation errors";
+                sbErrorPanel.Tag = String.Join("\n", new List<string>(failureMessages).ToArray());
             }
         }