changeset 214:a6ce13e4ae89 xml-export-ui

Near Final XSL output
author Dan.Kulinski@dank-laptop.Global.Local
date Thu, 18 Aug 2011 11:15:51 -0600
parents f57957fe9009
children a0df71b24972
files FrmXmlExport.Designer.cs FrmXmlExport.cs
diffstat 2 files changed, 59 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/FrmXmlExport.Designer.cs	Sun Aug 14 23:04:42 2011 -0600
+++ b/FrmXmlExport.Designer.cs	Thu Aug 18 11:15:51 2011 -0600
@@ -33,9 +33,10 @@
             this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
             this.bttnOutputSelect = new IBBoard.Windows.Forms.IBBButton();
             this.cbApplyTransform = new System.Windows.Forms.CheckBox();
-            this.cmbXslSelect = new System.Windows.Forms.ComboBox();
             this.bttnExport = new IBBoard.Windows.Forms.IBBButton();
             this.bttnCancel = new IBBoard.Windows.Forms.IBBButton();
+            this.tbXslPath = new System.Windows.Forms.TextBox();
+            this.bttnXslSelect = new IBBoard.Windows.Forms.IBBButton();
             this.SuspendLayout();
             // 
             // lbTitle
@@ -46,7 +47,6 @@
             this.lbTitle.Size = new System.Drawing.Size(61, 13);
             this.lbTitle.TabIndex = 0;
             this.lbTitle.Text = "XML Ouput";
-            this.lbTitle.Click += new System.EventHandler(this.ibbLabel1_Click);
             // 
             // tbOutputFile
             // 
@@ -75,20 +75,7 @@
             this.cbApplyTransform.TabIndex = 3;
             this.cbApplyTransform.Text = "Apply XSL Transform";
             this.cbApplyTransform.UseVisualStyleBackColor = true;
-            this.cbApplyTransform.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);
-            // 
-            // cmbXslSelect
-            // 
-            this.cmbXslSelect.Enabled = false;
-            this.cmbXslSelect.FormattingEnabled = true;
-            this.cmbXslSelect.Items.AddRange(new object[] {
-            "Default",
-            "..."});
-            this.cmbXslSelect.Location = new System.Drawing.Point(15, 77);
-            this.cmbXslSelect.Name = "cmbXslSelect";
-            this.cmbXslSelect.Size = new System.Drawing.Size(219, 21);
-            this.cmbXslSelect.TabIndex = 4;
-            this.cmbXslSelect.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
+            this.cbApplyTransform.CheckedChanged += new System.EventHandler(this.cbApplyTransform_CheckedChanged);
             // 
             // bttnExport
             // 
@@ -112,6 +99,25 @@
             this.bttnCancel.UseVisualStyleBackColor = true;
             this.bttnCancel.Click += new System.EventHandler(this.bttnCancel_Click);
             // 
+            // tbXslPath
+            // 
+            this.tbXslPath.Enabled = false;
+            this.tbXslPath.Location = new System.Drawing.Point(15, 77);
+            this.tbXslPath.Name = "tbXslPath";
+            this.tbXslPath.Size = new System.Drawing.Size(179, 20);
+            this.tbXslPath.TabIndex = 7;
+            // 
+            // bttnXslSelect
+            // 
+            this.bttnXslSelect.Enabled = false;
+            this.bttnXslSelect.Location = new System.Drawing.Point(202, 77);
+            this.bttnXslSelect.Name = "bttnXslSelect";
+            this.bttnXslSelect.Size = new System.Drawing.Size(32, 20);
+            this.bttnXslSelect.TabIndex = 8;
+            this.bttnXslSelect.Text = "...";
+            this.bttnXslSelect.UseVisualStyleBackColor = true;
+            this.bttnXslSelect.Click += new System.EventHandler(this.bttnXslSelect_Click);
+            // 
             // FrmXmlExport
             // 
             this.AcceptButton = this.bttnExport;
@@ -120,9 +126,10 @@
             this.CancelButton = this.bttnCancel;
             this.ClientSize = new System.Drawing.Size(241, 145);
             this.ControlBox = false;
+            this.Controls.Add(this.bttnXslSelect);
+            this.Controls.Add(this.tbXslPath);
             this.Controls.Add(this.bttnCancel);
             this.Controls.Add(this.bttnExport);
-            this.Controls.Add(this.cmbXslSelect);
             this.Controls.Add(this.cbApplyTransform);
             this.Controls.Add(this.bttnOutputSelect);
             this.Controls.Add(this.tbOutputFile);
@@ -147,8 +154,9 @@
         private System.Windows.Forms.SaveFileDialog saveFileDialog1;
         private Windows.Forms.IBBButton bttnOutputSelect;
         private System.Windows.Forms.CheckBox cbApplyTransform;
-        private System.Windows.Forms.ComboBox cmbXslSelect;
         private Windows.Forms.IBBButton bttnExport;
         private Windows.Forms.IBBButton bttnCancel;
+        private System.Windows.Forms.TextBox tbXslPath;
+        private Windows.Forms.IBBButton bttnXslSelect;
     }
 }
\ No newline at end of file
--- a/FrmXmlExport.cs	Sun Aug 14 23:04:42 2011 -0600
+++ b/FrmXmlExport.cs	Thu Aug 18 11:15:51 2011 -0600
@@ -5,6 +5,7 @@
 using System.Drawing;
 using System.Linq;
 using System.Text;
+using System.IO;
 using System.Windows.Forms;
 using IBBoard.WarFoundry.API.Objects;
 using IBBoard.WarFoundry.API.Exporters;
@@ -20,19 +21,9 @@
             myArmy = army;
         }
 
-        private void ibbLabel1_Click(object sender, EventArgs e)
-        {
-
-        }
-
         private void FrmXmlExport_Load(object sender, EventArgs e)
         {
-
-        }
-
-        private void checkBox1_CheckedChanged(object sender, EventArgs e)
-        {
-
+            tbXslPath.Text = Directory.GetCurrentDirectory() + "\\xsl\\default_html.xsl";
         }
 
         private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
@@ -63,6 +54,7 @@
         {
             if (cbApplyTransform.Checked)
             {
+                WarFoundryXmlWithXslExporter.GetDefault().ExportArmyWithTransform(myArmy, tbOutputFile.Text, tbXslPath.Text);
             }
             else
             {
@@ -70,6 +62,7 @@
             }
             
             this.DialogResult = DialogResult.OK;
+            this.Hide();
         }
 
         private void tbOutputFile_Change(object sender, EventArgs e)
@@ -83,5 +76,34 @@
                 bttnExport.Enabled = false;
             }
         }
+
+        private void cbApplyTransform_CheckedChanged(object sender, EventArgs e)
+        {
+            if (cbApplyTransform.Checked)
+            {
+                tbXslPath.Enabled = true;
+                bttnXslSelect.Enabled = true;
+            }
+            else
+            {
+                tbXslPath.Enabled = false;
+                bttnXslSelect.Enabled = false;
+            }
+        }
+
+        private void bttnXslSelect_Click(object sender, EventArgs e)
+        {
+            OpenFileDialog ofd = new OpenFileDialog();
+            
+            ofd.InitialDirectory = Directory.GetCurrentDirectory() + "\\xsl";
+            ofd.Filter = "XSL Files|*.xsl";
+            DialogResult result = ofd.ShowDialog();
+
+            if (result == DialogResult.OK)
+            {
+                tbXslPath.Text = ofd.FileName;
+            }
+          
+        }
     }
 }