# HG changeset patch # User IBBoard # Date 1292616883 0 # Node ID b42ba80ec613850587280eb1d77cf03ab1acdafa # Parent 0dadaa315430b7cc79d064473dfeaf5e9eac056b Fixes #319: WarFoundry Forge - No Factory set failure * Use new dummy factory when creating a new game system diff -r 0dadaa315430 -r b42ba80ec613 FrmMain.cs --- a/FrmMain.cs Thu Dec 16 18:52:30 2010 -0600 +++ b/FrmMain.cs Fri Dec 17 20:14:43 2010 +0000 @@ -39,12 +39,9 @@ private static readonly string AppTitle = "WarFoundry Forge"; internal static readonly string VERSION = "0.0.2"; const string DefaultDataDir = "data"; - private Preferences preferences; private readonly ILog log = LogManager.GetLogger(typeof(FrmMain)); - private CommandStack commandStack; - private string loadedFilePath; // Form contents @@ -197,8 +194,8 @@ // menuStrip // this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.menuFile, - this.menuHelp}); + this.menuFile, + this.menuHelp}); this.menuStrip.Location = new System.Drawing.Point(0, 0); this.menuStrip.Name = "menuStrip"; this.menuStrip.Size = new System.Drawing.Size(790, 24); @@ -208,10 +205,10 @@ // menuFile // this.menuFile.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.menuNew, - this.menuOpen, - this.toolStripSeparator2, - this.miExit}); + this.menuNew, + this.menuOpen, + this.toolStripSeparator2, + this.miExit}); this.menuFile.Name = "menuFile"; this.menuFile.Size = new System.Drawing.Size(33, 20); this.menuFile.Text = "&file"; @@ -261,7 +258,7 @@ // menuHelp // this.menuHelp.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.miAbout}); + this.miAbout}); this.menuHelp.Name = "menuHelp"; this.menuHelp.Size = new System.Drawing.Size(39, 20); this.menuHelp.Text = "&help"; @@ -288,6 +285,7 @@ this.ResumeLayout(false); this.PerformLayout(); } + #endregion private void FileLoadingFinished(List failures) @@ -297,22 +295,22 @@ log.Warn("Failed to load " + failure.FailedFile.FullName + ": " + failure.Message); } } - + private void miNewSystem_Click(object sender, System.EventArgs e) { - FrmSystem system = new FrmSystem(new GameSystem(" ", " ", null)); + FrmSystem system = new FrmSystem(new GameSystem(" ", " ", new DummyWarFoundryFactory())); system.ShowDialog(this); } private void miOpenSystem_Click(object sender, System.EventArgs e) { - if(OpenFile()) + if (OpenFile()) { FrmSystem system = new FrmSystem(CurrentGameSystem); system.ShowDialog(this); } } - + private bool OpenFile() { if (openFile.Filter == "") @@ -338,11 +336,11 @@ string newFilePath = openFile.FileName; ICollection fileContents = WarFoundryLoader.GetDefault().LoadFile(new FileInfo(newFilePath)); - if(fileContents.Count > 0) + if (fileContents.Count > 0) { - foreach(IWarFoundryObject fileObject in fileContents) + foreach (IWarFoundryObject fileObject in fileContents) { - if(fileObject is GameSystem) + if (fileObject is GameSystem) { CurrentGameSystem = (GameSystem)fileObject; }