changeset 213:f57957fe9009 xml-export-ui

UI Dialog for XML output
author Dan.Kulinski@dank-laptop.Global.Local
date Sun, 14 Aug 2011 23:04:42 -0600
parents 256f2f2f6e8c
children a6ce13e4ae89
files FrmXmlExport.Designer.cs FrmXmlExport.cs FrmXmlExport.resx
diffstat 3 files changed, 364 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/FrmXmlExport.Designer.cs	Sun Aug 14 23:04:42 2011 -0600
@@ -0,0 +1,154 @@
+namespace IBBoard.WarFoundry.GUI.WinForms
+{
+    partial class FrmXmlExport
+    {
+        /// <summary>
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows Form Designer generated code
+
+        /// <summary>
+        /// Required method for Designer support - do not modify
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.lbTitle = new IBBoard.Windows.Forms.IBBLabel();
+            this.tbOutputFile = new System.Windows.Forms.TextBox();
+            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.SuspendLayout();
+            // 
+            // lbTitle
+            // 
+            this.lbTitle.AutoSize = true;
+            this.lbTitle.Location = new System.Drawing.Point(12, 9);
+            this.lbTitle.Name = "lbTitle";
+            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
+            // 
+            this.tbOutputFile.Location = new System.Drawing.Point(15, 28);
+            this.tbOutputFile.Name = "tbOutputFile";
+            this.tbOutputFile.Size = new System.Drawing.Size(179, 20);
+            this.tbOutputFile.TabIndex = 1;
+            this.tbOutputFile.TextChanged += new System.EventHandler(this.tbOutputFile_Change);
+            // 
+            // bttnOutputSelect
+            // 
+            this.bttnOutputSelect.Location = new System.Drawing.Point(202, 28);
+            this.bttnOutputSelect.Name = "bttnOutputSelect";
+            this.bttnOutputSelect.Size = new System.Drawing.Size(32, 20);
+            this.bttnOutputSelect.TabIndex = 2;
+            this.bttnOutputSelect.Text = "...";
+            this.bttnOutputSelect.UseVisualStyleBackColor = true;
+            this.bttnOutputSelect.Click += new System.EventHandler(this.bttnOutputSelect_Click);
+            // 
+            // cbApplyTransform
+            // 
+            this.cbApplyTransform.AutoSize = true;
+            this.cbApplyTransform.Location = new System.Drawing.Point(15, 54);
+            this.cbApplyTransform.Name = "cbApplyTransform";
+            this.cbApplyTransform.Size = new System.Drawing.Size(125, 17);
+            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);
+            // 
+            // bttnExport
+            // 
+            this.bttnExport.Enabled = false;
+            this.bttnExport.Location = new System.Drawing.Point(78, 116);
+            this.bttnExport.Name = "bttnExport";
+            this.bttnExport.Size = new System.Drawing.Size(75, 23);
+            this.bttnExport.TabIndex = 5;
+            this.bttnExport.Text = "&Export";
+            this.bttnExport.UseVisualStyleBackColor = true;
+            this.bttnExport.Click += new System.EventHandler(this.bttnExport_Click);
+            // 
+            // bttnCancel
+            // 
+            this.bttnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
+            this.bttnCancel.Location = new System.Drawing.Point(159, 116);
+            this.bttnCancel.Name = "bttnCancel";
+            this.bttnCancel.Size = new System.Drawing.Size(75, 23);
+            this.bttnCancel.TabIndex = 6;
+            this.bttnCancel.Text = "&Cancel";
+            this.bttnCancel.UseVisualStyleBackColor = true;
+            this.bttnCancel.Click += new System.EventHandler(this.bttnCancel_Click);
+            // 
+            // FrmXmlExport
+            // 
+            this.AcceptButton = this.bttnExport;
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.CancelButton = this.bttnCancel;
+            this.ClientSize = new System.Drawing.Size(241, 145);
+            this.ControlBox = false;
+            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);
+            this.Controls.Add(this.lbTitle);
+            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
+            this.Name = "FrmXmlExport";
+            this.ShowIcon = false;
+            this.ShowInTaskbar = false;
+            this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
+            this.Text = "Export as XML";
+            this.TopMost = true;
+            this.Load += new System.EventHandler(this.FrmXmlExport_Load);
+            this.ResumeLayout(false);
+            this.PerformLayout();
+
+        }
+
+        #endregion
+
+        private Windows.Forms.IBBLabel lbTitle;
+        private System.Windows.Forms.TextBox tbOutputFile;
+        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;
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/FrmXmlExport.cs	Sun Aug 14 23:04:42 2011 -0600
@@ -0,0 +1,87 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Windows.Forms;
+using IBBoard.WarFoundry.API.Objects;
+using IBBoard.WarFoundry.API.Exporters;
+
+namespace IBBoard.WarFoundry.GUI.WinForms
+{
+    public partial class FrmXmlExport : Form
+    {
+        Army myArmy = null;
+        public FrmXmlExport(Army army)
+        {
+            InitializeComponent();
+            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)
+        {
+
+        }
+
+        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
+        {
+
+        }
+
+        private void bttnOutputSelect_Click(object sender, EventArgs e)
+        {
+            SaveFileDialog sfd = new SaveFileDialog();
+            sfd.Filter = "XML File|*.xml|HTML File|*.html|XHTML File|*.xhtml";
+            sfd.Title = "Save XML output";
+            sfd.ShowDialog();
+
+            if (sfd.FileName != "")
+            {
+                tbOutputFile.Text = sfd.FileName;
+            }
+        }
+
+        private void bttnCancel_Click(object sender, EventArgs e)
+        {
+            this.DialogResult = DialogResult.Cancel;
+            this.Hide();
+        }
+
+        private void bttnExport_Click(object sender, EventArgs e)
+        {
+            if (cbApplyTransform.Checked)
+            {
+            }
+            else
+            {
+                WarFoundryXmlWithXslExporter.GetDefault().ExportArmy(myArmy, tbOutputFile.Text);
+            }
+            
+            this.DialogResult = DialogResult.OK;
+        }
+
+        private void tbOutputFile_Change(object sender, EventArgs e)
+        {
+            if (tbOutputFile.Text != "")
+            {
+                bttnExport.Enabled = true;
+            }
+            else
+            {
+                bttnExport.Enabled = false;
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/FrmXmlExport.resx	Sun Aug 14 23:04:42 2011 -0600
@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <metadata name="saveFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>17, 17</value>
+  </metadata>
+</root>
\ No newline at end of file