changeset 199:f9ef9b2db496

Re #343: Show unit requirement failures * Add missing translation for dialog * Add first pass of showing messages when adding units (needs reworking due to space limitations)
author IBBoard <dev@ibboard.co.uk>
date Sun, 01 May 2011 19:31:26 +0000
parents 417d3f75a752
children 77043c3e0d94
files FrmNewUnit.cs translations/en.translation
diffstat 2 files changed, 7 insertions(+), 5 deletions(-) [+]
line diff
     1.1 --- a/FrmNewUnit.cs	Sun May 01 19:30:33 2011 +0000
     1.2 +++ b/FrmNewUnit.cs	Sun May 01 19:31:26 2011 +0000
     1.3 @@ -2,7 +2,8 @@
     1.4  //
     1.5  // The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license.
     1.6  
     1.7 -using System;
     1.8 +using System;
     1.9 +using System.Collections.Generic;
    1.10  using System.Drawing;
    1.11  using System.ComponentModel;
    1.12  using System.Windows.Forms;
    1.13 @@ -198,14 +199,14 @@
    1.14  		{
    1.15  			if (lstUnits.SelectedIndex>-1)
    1.16  			{
    1.17 -				bttnSelectUnit.Enabled = true;
    1.18 -				lblNewUnitWarning.Visible = !Validates.AsOkay(RequirementHandler.AllowsAdding(SelectedUnit, army));
    1.19 +				bttnSelectUnit.Enabled = true;
    1.20 +                ICollection<string> failureMessages;
    1.21 +				lblNewUnitWarning.Visible = !Validates.AsOkay(RequirementHandler.AllowsAdding(SelectedUnit, army, out failureMessages));
    1.22  				lblWarningIcon.Visible = lblNewUnitWarning.Visible;
    1.23  
    1.24  				if (lblNewUnitWarning.Visible)
    1.25  				{
    1.26 -					//lblNewUnitWarning.Text = army.GetFailedAddRequirement(units[lstUnits.SelectedIndex]).Description;
    1.27 -                    //FIXME: Add failed requirement text
    1.28 +					lblNewUnitWarning.Text = String.Join("\n", new List<string>(failureMessages).ToArray());
    1.29  				}
    1.30  			}
    1.31  			else
     2.1 --- a/translations/en.translation	Sun May 01 19:30:33 2011 +0000
     2.2 +++ b/translations/en.translation	Sun May 01 19:31:26 2011 +0000
     2.3 @@ -130,4 +130,5 @@
     2.4    <translation id="GameSystemFilesReloaded">Game system and race files reloaded</translation>
     2.5    <translation id="treeNodeText">{0} ({1} {2})</translation>
     2.6    <translation id="setUnitEquipmentItemName">( {0} {1} each)</translation>
     2.7 +  <translation id="FailedRequirementMessage">Army Requirement Failures</translation>
     2.8  </translations>
     2.9 \ No newline at end of file