# HG changeset patch
# User snowblizz
# Date 1291233607 0
# Node ID d084446348f5f7f1ddf8ac2d46418837a2e7c21d
# Parent 00ffe6109ca5d06c209b300dde2a7e6261d637f8
RRe #97: Default army size issues
diff -r 00ffe6109ca5 -r d084446348f5 FrmNewArmy.cs
--- a/FrmNewArmy.cs Tue Nov 02 20:28:00 2010 +0000
+++ b/FrmNewArmy.cs Wed Dec 01 20:00:07 2010 +0000
@@ -19,7 +19,8 @@
/// Summary description for FrmNewArmy.
///
public class FrmNewArmy : IBBForm
- {
+ {
+ private static int SYSTEM_DEFAULT_ARMY_SIZE = 1000;
private IContainer components;
private IBBoard.Windows.Forms.IBBButton bttnCancel;
private IBBoard.Windows.Forms.IBBLabel lblRaceList;
@@ -35,6 +36,7 @@
private GameSystem system;
private Race race;
private string armyName;
+ public bool isDefaultArmyName;
private ToolTip gameSystemToolTip;
private int maxPoints;
@@ -209,11 +211,12 @@
this.armySize.TabIndex = 11;
this.armySize.ThousandsSeparator = true;
this.armySize.Value = new decimal(new int[] {
- 2000,
+ SYSTEM_DEFAULT_ARMY_SIZE,
0,
0,
0});
- //
+ this.armySize.ValueChanged += new System.EventHandler(this.armySize_ValueChanged);
+ //
// gameSystems
//
this.gameSystems.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
@@ -307,38 +310,65 @@
maxPoints = (int) armySize.Value;
}
- private GameSystem GetSelectedGameSystem()
+ private void armySize_ValueChanged(object sender, System.EventArgs e)
+ {
+ if (txtArmyName.Enabled && isDefaultArmyName)
+ {
+ setTxtArmyNameVal();
+ }
+ }
+
+ private GameSystem GetSelectedGameSystem()
{
return (GameSystem) gameSystems.SelectedItem;
}
private void txtArmyName_TextChanged(object sender, System.EventArgs e)
{
- setSelectRaceEnabledVal();
+ isDefaultArmyName = false ;
+ setSelectRaceEnabledVal();
}
private void setSelectRaceEnabledVal()
- {
+ {
bttnSelectRace.Enabled = (lstRaces.SelectedIndex>-1 && txtArmyName.Text.Trim()!="" && armySize.Value > 0);
}
- private void lstRaces_SelectedIndexChanged(object sender, System.EventArgs e)
+ private void setTxtArmyNameVal()
+ {
+ txtArmyName.Text = String.Format(race.ArmyDefaultName, Translation.GetTranslation("armySizePts", "{0}pt", armySize.Value));
+ isDefaultArmyName = true;
+ }
+
+ private void lstRaces_SelectedIndexChanged(object sender, System.EventArgs e)
{
setSelectRaceEnabledVal();
bool raceSelected = lstRaces.SelectedItem != null;
txtArmyName.Enabled = raceSelected;
armySize.Enabled = raceSelected;
race = (Race)lstRaces.SelectedItem;
- txtArmyName.Text = String.Format(race.ArmyDefaultName, Translation.GetTranslation("armySizePts", "{0}pt", armySize.Value));
+ setTxtArmyNameVal();
}
private void gameSystems_SelectedValueChanged(object sender, EventArgs e)
{
- GameSystem selected = GetSelectedGameSystem();
- lstRaces.Items.Clear();
+
+ GameSystem selected = GetSelectedGameSystem();
+ txtArmyName.Text = "";
+ txtArmyName.Enabled = false;
+ lstRaces.Items.Clear();
+
+
+ if (selected != null)
+ {
- if (selected != null)
- {
+ if (selected.SystemArmyDefaultSize != 1)
+ {
+ System.Diagnostics.Debug.WriteLine("defaultSize:" + selected.SystemArmyDefaultSize);
+ System.Diagnostics.Debug.WriteLine("system:" + selected.ID);
+ armySize.Value = (decimal) selected.SystemArmyDefaultSize;//}
+ }
+
SetRaces(selected);
if (lstRaces.Items.Count == 1)
@@ -348,6 +378,8 @@
}
lstRaces.Enabled = lstRaces.Items.Count > 0;
+
+
}
}
}
diff -r 00ffe6109ca5 -r d084446348f5 IBBoard.WarFoundry.GUI.WinForms.csproj
--- a/IBBoard.WarFoundry.GUI.WinForms.csproj Tue Nov 02 20:28:00 2010 +0000
+++ b/IBBoard.WarFoundry.GUI.WinForms.csproj Wed Dec 01 20:00:07 2010 +0000
@@ -115,7 +115,6 @@
-