comparison FrmNewArmy.cs @ 220:467decfdde8e

Closes #327: "Points" system should be used in UI * Add abbreviation and name as options to default name * Translation armySizePts now supports {0} (size), {1} (pts abbrev) and {2} (pts name) * Future additions of "points" systems should be coded with appropriate calls
author IBBoard <dev@ibboard.co.uk>
date Mon, 29 Aug 2011 15:17:59 +0100
parents ec2b73de16ba
children 2bde6d18d3bd
comparison
equal deleted inserted replaced
219:ec2b73de16ba 220:467decfdde8e
332 private void setSelectRaceEnabledVal() 332 private void setSelectRaceEnabledVal()
333 { 333 {
334 bttnSelectRace.Enabled = (lstRaces.SelectedIndex>-1 && txtArmyName.Text.Trim()!="" && armySize.Value > 0); 334 bttnSelectRace.Enabled = (lstRaces.SelectedIndex>-1 && txtArmyName.Text.Trim()!="" && armySize.Value > 0);
335 } 335 }
336 336
337 private void setTxtArmyNameVal() 337 private void setTxtArmyNameVal()
338 { 338 {
339 if (lstRaces.SelectedIndex > -1) 339 if (lstRaces.SelectedIndex > -1)
340 { 340 {
341 txtArmyName.Text = String.Format(race.ArmyDefaultName, Translation.GetTranslation("armySizePts", "{0}pt", armySize.Value)); 341 double armySizeDbl = (double)armySize.Value;
342 isDefaultArmyName = true; 342 txtArmyName.Text = String.Format(race.ArmyDefaultName, Translation.GetTranslation("armySizePts", "{0}{1}", armySizeDbl, system.GetPointsAbbrev(armySizeDbl), system.GetPointsName(armySizeDbl)));
343 } 343 isDefaultArmyName = true;
344 } 344 }
345 }
345 346
346 private void lstRaces_SelectedIndexChanged(object sender, System.EventArgs e) 347 private void lstRaces_SelectedIndexChanged(object sender, System.EventArgs e)
347 { 348 {
348 setSelectRaceEnabledVal(); 349 setSelectRaceEnabledVal();
349 bool raceSelected = lstRaces.SelectedItem != null; 350 bool raceSelected = lstRaces.SelectedItem != null;
353 setTxtArmyNameVal(); 354 setTxtArmyNameVal();
354 } 355 }
355 356
356 private void gameSystems_SelectedValueChanged(object sender, EventArgs e) 357 private void gameSystems_SelectedValueChanged(object sender, EventArgs e)
357 { 358 {
358 359 system = GetSelectedGameSystem();
359 GameSystem selected = GetSelectedGameSystem();
360 txtArmyName.Text = ""; 360 txtArmyName.Text = "";
361 txtArmyName.Enabled = false; 361 txtArmyName.Enabled = false;
362 lstRaces.Items.Clear(); 362 lstRaces.Items.Clear();
363 armySize.Value = selected.SystemArmyDefaultSize; 363 armySize.Value = system.SystemArmyDefaultSize;
364 364
365 if (selected != null) 365 if (system != null)
366 { 366 {
367 SetRaces(selected); 367 SetRaces(system);
368 368
369 if (lstRaces.Items.Count == 1) 369 if (lstRaces.Items.Count == 1)
370 { 370 {
371 lstRaces.SelectedIndex = 0; 371 lstRaces.SelectedIndex = 0;
372 } 372 }