changeset 9:b42ba80ec613

Fixes #319: WarFoundry Forge - No Factory set failure * Use new dummy factory when creating a new game system
author IBBoard <dev@ibboard.co.uk>
date Fri, 17 Dec 2010 20:14:43 +0000
parents 0dadaa315430
children 6284c091b132
files FrmMain.cs
diffstat 1 files changed, 15 insertions(+), 17 deletions(-) [+]
line diff
     1.1 --- a/FrmMain.cs	Thu Dec 16 18:52:30 2010 -0600
     1.2 +++ b/FrmMain.cs	Fri Dec 17 20:14:43 2010 +0000
     1.3 @@ -39,12 +39,9 @@
     1.4  		private static readonly string AppTitle = "WarFoundry Forge";
     1.5  		internal static readonly string VERSION = "0.0.2";
     1.6  		const string DefaultDataDir = "data";
     1.7 -
     1.8  		private Preferences preferences;
     1.9  		private readonly ILog log = LogManager.GetLogger(typeof(FrmMain));
    1.10 -
    1.11  		private CommandStack commandStack;
    1.12 -		
    1.13  		private string loadedFilePath;
    1.14  
    1.15  		// Form contents
    1.16 @@ -197,8 +194,8 @@
    1.17  			// menuStrip
    1.18  			// 
    1.19  			this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
    1.20 -            this.menuFile,
    1.21 -            this.menuHelp});
    1.22 +			this.menuFile, 
    1.23 +			this.menuHelp});
    1.24  			this.menuStrip.Location = new System.Drawing.Point(0, 0);
    1.25  			this.menuStrip.Name = "menuStrip";
    1.26  			this.menuStrip.Size = new System.Drawing.Size(790, 24);
    1.27 @@ -208,10 +205,10 @@
    1.28  			// menuFile
    1.29  			// 
    1.30  			this.menuFile.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
    1.31 -			this.menuNew,
    1.32 -			this.menuOpen,
    1.33 -			this.toolStripSeparator2,
    1.34 -            this.miExit});
    1.35 +			this.menuNew, 
    1.36 +			this.menuOpen, 
    1.37 +			this.toolStripSeparator2, 
    1.38 +			this.miExit});
    1.39  			this.menuFile.Name = "menuFile";
    1.40  			this.menuFile.Size = new System.Drawing.Size(33, 20);
    1.41  			this.menuFile.Text = "&file";
    1.42 @@ -261,7 +258,7 @@
    1.43  			// menuHelp
    1.44  			// 
    1.45  			this.menuHelp.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
    1.46 -            this.miAbout});
    1.47 +			this.miAbout});
    1.48  			this.menuHelp.Name = "menuHelp";
    1.49  			this.menuHelp.Size = new System.Drawing.Size(39, 20);
    1.50  			this.menuHelp.Text = "&help";
    1.51 @@ -288,6 +285,7 @@
    1.52  			this.ResumeLayout(false);
    1.53  			this.PerformLayout();
    1.54  		}
    1.55 +
    1.56  		#endregion
    1.57  
    1.58  		private void FileLoadingFinished(List<FileLoadFailure> failures)
    1.59 @@ -297,22 +295,22 @@
    1.60  				log.Warn("Failed to load " + failure.FailedFile.FullName + ": " + failure.Message);
    1.61  			}
    1.62  		}
    1.63 -		
    1.64 +
    1.65  		private void miNewSystem_Click(object sender, System.EventArgs e)
    1.66  		{
    1.67 -			FrmSystem system = new FrmSystem(new GameSystem(" ", " ", null));
    1.68 +			FrmSystem system = new FrmSystem(new GameSystem(" ", " ", new DummyWarFoundryFactory()));
    1.69  			system.ShowDialog(this);
    1.70  		}
    1.71  
    1.72  		private void miOpenSystem_Click(object sender, System.EventArgs e)
    1.73  		{
    1.74 -			if(OpenFile())
    1.75 +			if (OpenFile())
    1.76  			{
    1.77  				FrmSystem system = new FrmSystem(CurrentGameSystem);
    1.78  				system.ShowDialog(this);
    1.79  			}
    1.80  		}
    1.81 -		
    1.82 +
    1.83  		private bool OpenFile()
    1.84  		{
    1.85  			if (openFile.Filter == "")
    1.86 @@ -338,11 +336,11 @@
    1.87  					string newFilePath = openFile.FileName;
    1.88  					ICollection<IWarFoundryObject> fileContents = WarFoundryLoader.GetDefault().LoadFile(new FileInfo(newFilePath));
    1.89  					
    1.90 -					if(fileContents.Count > 0)
    1.91 +					if (fileContents.Count > 0)
    1.92  					{
    1.93 -						foreach(IWarFoundryObject fileObject in fileContents)
    1.94 +						foreach (IWarFoundryObject fileObject in fileContents)
    1.95  						{
    1.96 -							if(fileObject is GameSystem)
    1.97 +							if (fileObject is GameSystem)
    1.98  							{
    1.99  								CurrentGameSystem = (GameSystem)fileObject;
   1.100  							}