# HG changeset patch # User IBBoard # Date 1253963893 0 # Node ID 75cf9b6608f5d7d21dda091d8d4d4160f1a77c74 # Parent 68d4f7499212a409eb4dd2c743c1a3567114293f 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 diff -r 68d4f7499212 -r 75cf9b6608f5 FrmMain.cs --- a/FrmMain.cs Sat Sep 26 09:51:53 2009 +0000 +++ b/FrmMain.cs Sat Sep 26 11:18:13 2009 +0000 @@ -286,7 +286,7 @@ this.sbMainPanel.Color = System.Drawing.SystemColors.WindowText; this.sbMainPanel.Name = "sbMainPanel"; this.sbMainPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw; - this.sbMainPanel.Width = 475; + this.sbMainPanel.Width = 473; // // sbErrorPanel // @@ -532,6 +532,7 @@ this.Menu = this.mainMenu; this.Name = "FrmMain"; this.Text = "WarFoundry"; + this.Load += new System.EventHandler(this.FrmMain_Load); ((System.ComponentModel.ISupportInitialize) (this.sbMainPanel)).EndInit(); ((System.ComponentModel.ISupportInitialize) (this.sbErrorPanel)).EndInit(); ((System.ComponentModel.ISupportInitialize) (this.sbPointsPanel)).EndInit(); @@ -1269,5 +1270,22 @@ WarFoundryHtmlExporter.GetDefault().ExportArmy(army, filePath); } } + + private void FrmMain_Load(object sender, EventArgs e) + { + string gameSystemID = Preferences.GetStringProperty("currSystem"); + + if (gameSystemID != null && !"".Equals(gameSystemID)) + { + logger.Debug("Attempting to load current game system from properties"); + GameSystem sys = WarFoundryLoader.GetDefault().GetGameSystem(gameSystemID); + + if (sys != null) + { + WarFoundryCore.CurrentGameSystem = sys; + logger.InfoFormat("Loaded game system {0} from properties", gameSystemID); + } + } + } } }