changeset 7:9828ba4f3f36

Closes #43 - Test Ticket for checking into SVN * First Check-in! * Did some code changes to allow the app to load default race and system files from the "data" directory. * Also changed select system dialog so you can actually select a game system.
author gregmita
date Sat, 07 Mar 2009 21:08:31 +0000
parents aca4eb3fae50
children 755e60be28be
files FrmMain.cs FrmSelectSystem.cs
diffstat 2 files changed, 18 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/FrmMain.cs	Sun Mar 01 15:31:02 2009 +0000
+++ b/FrmMain.cs	Sat Mar 07 21:08:31 2009 +0000
@@ -24,7 +24,9 @@
 using IBBoard.WarFoundry.API;
 using IBBoard.WarFoundry.API.Commands;
 using IBBoard.WarFoundry.API.Objects;
-using IBBoard.WarFoundry.API.Savers;
+using IBBoard.WarFoundry.API.Savers;
+using IBBoard.WarFoundry.API.Factories;
+using IBBoard.WarFoundry.API.Factories.Xml;
 
 namespace IBBoard.WarFoundry
 {
@@ -34,6 +36,7 @@
 	public class FrmMain : System.Windows.Forms.Form
 	{
 		private static readonly string AppTitle = "WarFoundry";
+        const string DefaultDataDir = "data";
 
         private Preferences preferences;
         protected readonly ILog logger = LogManager.GetLogger(typeof(FrmMain));
@@ -136,7 +139,17 @@
 			armyTree.Show();
 			armyTree.StartPosition = FormStartPosition.Manual;
 			armyTree.Location = new Point(this.DisplayRectangle.Width - armyTree.Width - 10, 10);
-            ControlTranslator.TranslateControl(armyTree);
+            ControlTranslator.TranslateControl(armyTree);
+
+            // hack to load default files
+            WarFoundryLoader.GetDefault().AddLoadDirectory(new DirectoryInfo(Constants.ExecutablePath + Constants.DirectoryString + DefaultDataDir));
+
+            IWarFoundryFactory factory = WarFoundryFactoryFactory.GetFactoryFactory().GetFactory(typeof(WarFoundryXmlFactory));
+
+            if (factory != null && factory is WarFoundryXmlFactory)
+            {
+                WarFoundryLoader.GetDefault().RegisterFactory((WarFoundryXmlFactory)factory);
+            }
 
             /*
             if (args.Length == 1)
--- a/FrmSelectSystem.cs	Sun Mar 01 15:31:02 2009 +0000
+++ b/FrmSelectSystem.cs	Sat Mar 07 21:08:31 2009 +0000
@@ -154,10 +154,10 @@
 
 		private void bttnSelectSystem_Click(object sender, System.EventArgs e)
 		{
-//            selectedSystem = lstSystems.
-            //TODO: Set game system
+            // set the selected system
+            selectedSystem = (GameSystem) lstSystems.SelectedItem;
 
-			this.DialogResult = DialogResult.OK;
+            this.DialogResult = DialogResult.OK;
 			this.Close();
 		}