changeset 67:75cf9b6608f5

Re #161: Re-implement "load last used game system by default" in WinForms * Add same stub as GTK# - load game system defined by preferences, but don't save last used yet
author IBBoard <dev@ibboard.co.uk>
date Sat, 26 Sep 2009 11:18:13 +0000
parents 68d4f7499212
children fd8654afd331
files FrmMain.cs
diffstat 1 files changed, 19 insertions(+), 1 deletions(-) [+]
line diff
     1.1 --- a/FrmMain.cs	Sat Sep 26 09:51:53 2009 +0000
     1.2 +++ b/FrmMain.cs	Sat Sep 26 11:18:13 2009 +0000
     1.3 @@ -286,7 +286,7 @@
     1.4  			this.sbMainPanel.Color = System.Drawing.SystemColors.WindowText;
     1.5  			this.sbMainPanel.Name = "sbMainPanel";
     1.6  			this.sbMainPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw;
     1.7 -			this.sbMainPanel.Width = 475;
     1.8 +			this.sbMainPanel.Width = 473;
     1.9  			// 
    1.10  			// sbErrorPanel
    1.11  			// 
    1.12 @@ -532,6 +532,7 @@
    1.13  			this.Menu = this.mainMenu;
    1.14  			this.Name = "FrmMain";
    1.15  			this.Text = "WarFoundry";
    1.16 +			this.Load += new System.EventHandler(this.FrmMain_Load);
    1.17  			((System.ComponentModel.ISupportInitialize) (this.sbMainPanel)).EndInit();
    1.18  			((System.ComponentModel.ISupportInitialize) (this.sbErrorPanel)).EndInit();
    1.19  			((System.ComponentModel.ISupportInitialize) (this.sbPointsPanel)).EndInit();
    1.20 @@ -1269,5 +1270,22 @@
    1.21  				WarFoundryHtmlExporter.GetDefault().ExportArmy(army, filePath);
    1.22  			}
    1.23  		}
    1.24 +
    1.25 +		private void FrmMain_Load(object sender, EventArgs e)
    1.26 +		{
    1.27 +			string gameSystemID = Preferences.GetStringProperty("currSystem");
    1.28 +
    1.29 +			if (gameSystemID != null && !"".Equals(gameSystemID))
    1.30 +			{
    1.31 +				logger.Debug("Attempting to load current game system from properties");
    1.32 +				GameSystem sys = WarFoundryLoader.GetDefault().GetGameSystem(gameSystemID);
    1.33 +
    1.34 +				if (sys != null)
    1.35 +				{
    1.36 +					WarFoundryCore.CurrentGameSystem = sys;
    1.37 +					logger.InfoFormat("Loaded game system {0} from properties", gameSystemID);
    1.38 +				}
    1.39 +			}
    1.40 +		}
    1.41  	}
    1.42  }