Mercurial > repos > IBDev-IBBoard.WarFoundry.GUI.WinForms
diff FrmMain.cs @ 54:d6ff354a5d84
Re #166: Move game system changing to part of army creation
* Initial commit - code works but naming isn't correct
* Remove system selection dialog
* Add game system selection to FrmNewArmy
* Populate race list based on game system selected
* Always enable "New Army" button/menu item
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 19 Sep 2009 10:27:01 +0000 |
parents | 93b3d23147ba |
children | 039b02006a8a |
line wrap: on
line diff
--- a/FrmMain.cs Wed Sep 16 19:50:39 2009 +0000 +++ b/FrmMain.cs Sat Sep 19 10:27:01 2009 +0000 @@ -70,8 +70,6 @@ private IBBoard.Windows.Forms.IBBMenuItem miSaveArmy; private IBBoard.Windows.Forms.IBBMenuItem miSaveArmyAs; private System.Windows.Forms.MenuItem miSep2; - private IBBoard.Windows.Forms.IBBMenuItem miChangeSystem; - private System.Windows.Forms.MenuItem miSep1; private IBBoard.Windows.Forms.IBBMenuItem miReloadFiles; private System.Windows.Forms.MenuItem miSep3; private IBBoard.Windows.Forms.IBBMenuItem miExit; @@ -228,8 +226,6 @@ this.miExportArmyAs = new System.Windows.Forms.MenuItem(); this.miExportArmyAsBasicHTML = new System.Windows.Forms.MenuItem(); this.miCloseArmy = new IBBoard.Windows.Forms.IBBMenuItem(); - this.miSep1 = new System.Windows.Forms.MenuItem(); - this.miChangeSystem = new IBBoard.Windows.Forms.IBBMenuItem(); this.miSep2 = new System.Windows.Forms.MenuItem(); this.miReloadFiles = new IBBoard.Windows.Forms.IBBMenuItem(); this.miSep3 = new System.Windows.Forms.MenuItem(); @@ -287,7 +283,6 @@ // // toolBar // - this.toolBar.Appearance = System.Windows.Forms.ToolBarAppearance.Flat; this.toolBar.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] { this.bttnNewArmy, this.bttnOpenArmy, @@ -307,7 +302,6 @@ // // bttnNewArmy // - this.bttnNewArmy.Enabled = false; this.bttnNewArmy.ImageIndex = 0; this.bttnNewArmy.Name = "bttnNewArmy"; // @@ -372,8 +366,6 @@ this.miSaveArmyAs, this.miExportArmyAs, this.miCloseArmy, - this.miSep1, - this.miChangeSystem, this.miSep2, this.miReloadFiles, this.miSep3, @@ -382,7 +374,6 @@ // // miNewArmy // - this.miNewArmy.Enabled = false; this.miNewArmy.Index = 0; this.miNewArmy.Text = "&new army"; this.miNewArmy.Click += new System.EventHandler(this.miNewArmy_Click); @@ -428,36 +419,25 @@ this.miCloseArmy.Text = "&close army"; this.miCloseArmy.Click += new System.EventHandler(this.miCloseArmy_Click); // - // miSep1 - // - this.miSep1.Index = 6; - this.miSep1.Text = "-"; - // - // miChangeSystem - // - this.miChangeSystem.Index = 7; - this.miChangeSystem.Text = "change &game system"; - this.miChangeSystem.Click += new System.EventHandler(this.miChangeSystem_Click); - // // miSep2 // - this.miSep2.Index = 8; + this.miSep2.Index = 6; this.miSep2.Text = "-"; // // miReloadFiles // - this.miReloadFiles.Index = 9; + this.miReloadFiles.Index = 7; this.miReloadFiles.Text = "&reload files"; this.miReloadFiles.Click += new System.EventHandler(this.miReloadFiles_Click); // // miSep3 // - this.miSep3.Index = 10; + this.miSep3.Index = 8; this.miSep3.Text = "-"; // // miExit // - this.miExit.Index = 11; + this.miExit.Index = 9; this.miExit.Text = "e&xit"; this.miExit.Click += new System.EventHandler(this.miExit_Click); // @@ -795,39 +775,20 @@ } } - private GameSystem CurrentGameSystem + public static GameSystem CurrentGameSystem { get { return WarFoundryCore.CurrentGameSystem; } set { WarFoundryCore.CurrentGameSystem = value; } } - private static Army CurrentArmy + public static Army CurrentArmy { get { return WarFoundryCore.CurrentArmy; } set { WarFoundryCore.CurrentArmy = value; } } - private void SelectGameSystem() - { - FrmSelectSystem selectSystem = new FrmSelectSystem(); - DialogResult dr = selectSystem.ShowDialog(this); - - if (dr==DialogResult.OK) - { - CloseCurrentArmy(); - CurrentGameSystem = selectSystem.GameSystem; - } - } - - private void miChangeSystem_Click(object sender, System.EventArgs e) - { - SelectGameSystem(); - } - private void FrmMain_GameSystemChanged(GameSystem oldSystem, GameSystem newSystem) { - miNewArmy.Enabled = newSystem != null; - bttnNewArmy.Enabled = newSystem != null; SetAppTitle(); RemoveCategoryButtons(); AddCategoryButtons(); @@ -1252,7 +1213,7 @@ if (dr == DialogResult.OK) { - Army army = WarFoundryCore.CurrentArmy; + Army army = CurrentArmy; string filePath = dialog.FileName; logger.DebugFormat("Exporting {0} to {1} as basic HTML", army.Name, filePath); WarFoundryHtmlExporter.GetDefault().ExportArmy(army, filePath);