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 wrap: on
line diff
--- 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);
+				}
+			}
+		}
 	}
 }