changeset 209: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 diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/FrmXmlExport.Designer.cs	Sun Aug 14 23:04:42 2011 -0600
     1.3 @@ -0,0 +1,154 @@
     1.4 +´╗┐namespace IBBoard.WarFoundry.GUI.WinForms
     1.5 +{
     1.6 +    partial class FrmXmlExport
     1.7 +    {
     1.8 +        /// <summary>
     1.9 +        /// Required designer variable.
    1.10 +        /// </summary>
    1.11 +        private System.ComponentModel.IContainer components = null;
    1.12 +
    1.13 +        /// <summary>
    1.14 +        /// Clean up any resources being used.
    1.15 +        /// </summary>
    1.16 +        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
    1.17 +        protected override void Dispose(bool disposing)
    1.18 +        {
    1.19 +            if (disposing && (components != null))
    1.20 +            {
    1.21 +                components.Dispose();
    1.22 +            }
    1.23 +            base.Dispose(disposing);
    1.24 +        }
    1.25 +
    1.26 +        #region Windows Form Designer generated code
    1.27 +
    1.28 +        /// <summary>
    1.29 +        /// Required method for Designer support - do not modify
    1.30 +        /// the contents of this method with the code editor.
    1.31 +        /// </summary>
    1.32 +        private void InitializeComponent()
    1.33 +        {
    1.34 +            this.lbTitle = new IBBoard.Windows.Forms.IBBLabel();
    1.35 +            this.tbOutputFile = new System.Windows.Forms.TextBox();
    1.36 +            this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
    1.37 +            this.bttnOutputSelect = new IBBoard.Windows.Forms.IBBButton();
    1.38 +            this.cbApplyTransform = new System.Windows.Forms.CheckBox();
    1.39 +            this.cmbXslSelect = new System.Windows.Forms.ComboBox();
    1.40 +            this.bttnExport = new IBBoard.Windows.Forms.IBBButton();
    1.41 +            this.bttnCancel = new IBBoard.Windows.Forms.IBBButton();
    1.42 +            this.SuspendLayout();
    1.43 +            // 
    1.44 +            // lbTitle
    1.45 +            // 
    1.46 +            this.lbTitle.AutoSize = true;
    1.47 +            this.lbTitle.Location = new System.Drawing.Point(12, 9);
    1.48 +            this.lbTitle.Name = "lbTitle";
    1.49 +            this.lbTitle.Size = new System.Drawing.Size(61, 13);
    1.50 +            this.lbTitle.TabIndex = 0;
    1.51 +            this.lbTitle.Text = "XML Ouput";
    1.52 +            this.lbTitle.Click += new System.EventHandler(this.ibbLabel1_Click);
    1.53 +            // 
    1.54 +            // tbOutputFile
    1.55 +            // 
    1.56 +            this.tbOutputFile.Location = new System.Drawing.Point(15, 28);
    1.57 +            this.tbOutputFile.Name = "tbOutputFile";
    1.58 +            this.tbOutputFile.Size = new System.Drawing.Size(179, 20);
    1.59 +            this.tbOutputFile.TabIndex = 1;
    1.60 +            this.tbOutputFile.TextChanged += new System.EventHandler(this.tbOutputFile_Change);
    1.61 +            // 
    1.62 +            // bttnOutputSelect
    1.63 +            // 
    1.64 +            this.bttnOutputSelect.Location = new System.Drawing.Point(202, 28);
    1.65 +            this.bttnOutputSelect.Name = "bttnOutputSelect";
    1.66 +            this.bttnOutputSelect.Size = new System.Drawing.Size(32, 20);
    1.67 +            this.bttnOutputSelect.TabIndex = 2;
    1.68 +            this.bttnOutputSelect.Text = "...";
    1.69 +            this.bttnOutputSelect.UseVisualStyleBackColor = true;
    1.70 +            this.bttnOutputSelect.Click += new System.EventHandler(this.bttnOutputSelect_Click);
    1.71 +            // 
    1.72 +            // cbApplyTransform
    1.73 +            // 
    1.74 +            this.cbApplyTransform.AutoSize = true;
    1.75 +            this.cbApplyTransform.Location = new System.Drawing.Point(15, 54);
    1.76 +            this.cbApplyTransform.Name = "cbApplyTransform";
    1.77 +            this.cbApplyTransform.Size = new System.Drawing.Size(125, 17);
    1.78 +            this.cbApplyTransform.TabIndex = 3;
    1.79 +            this.cbApplyTransform.Text = "Apply XSL Transform";
    1.80 +            this.cbApplyTransform.UseVisualStyleBackColor = true;
    1.81 +            this.cbApplyTransform.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);
    1.82 +            // 
    1.83 +            // cmbXslSelect
    1.84 +            // 
    1.85 +            this.cmbXslSelect.Enabled = false;
    1.86 +            this.cmbXslSelect.FormattingEnabled = true;
    1.87 +            this.cmbXslSelect.Items.AddRange(new object[] {
    1.88 +            "Default",
    1.89 +            "..."});
    1.90 +            this.cmbXslSelect.Location = new System.Drawing.Point(15, 77);
    1.91 +            this.cmbXslSelect.Name = "cmbXslSelect";
    1.92 +            this.cmbXslSelect.Size = new System.Drawing.Size(219, 21);
    1.93 +            this.cmbXslSelect.TabIndex = 4;
    1.94 +            this.cmbXslSelect.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
    1.95 +            // 
    1.96 +            // bttnExport
    1.97 +            // 
    1.98 +            this.bttnExport.Enabled = false;
    1.99 +            this.bttnExport.Location = new System.Drawing.Point(78, 116);
   1.100 +            this.bttnExport.Name = "bttnExport";
   1.101 +            this.bttnExport.Size = new System.Drawing.Size(75, 23);
   1.102 +            this.bttnExport.TabIndex = 5;
   1.103 +            this.bttnExport.Text = "&Export";
   1.104 +            this.bttnExport.UseVisualStyleBackColor = true;
   1.105 +            this.bttnExport.Click += new System.EventHandler(this.bttnExport_Click);
   1.106 +            // 
   1.107 +            // bttnCancel
   1.108 +            // 
   1.109 +            this.bttnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
   1.110 +            this.bttnCancel.Location = new System.Drawing.Point(159, 116);
   1.111 +            this.bttnCancel.Name = "bttnCancel";
   1.112 +            this.bttnCancel.Size = new System.Drawing.Size(75, 23);
   1.113 +            this.bttnCancel.TabIndex = 6;
   1.114 +            this.bttnCancel.Text = "&Cancel";
   1.115 +            this.bttnCancel.UseVisualStyleBackColor = true;
   1.116 +            this.bttnCancel.Click += new System.EventHandler(this.bttnCancel_Click);
   1.117 +            // 
   1.118 +            // FrmXmlExport
   1.119 +            // 
   1.120 +            this.AcceptButton = this.bttnExport;
   1.121 +            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
   1.122 +            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
   1.123 +            this.CancelButton = this.bttnCancel;
   1.124 +            this.ClientSize = new System.Drawing.Size(241, 145);
   1.125 +            this.ControlBox = false;
   1.126 +            this.Controls.Add(this.bttnCancel);
   1.127 +            this.Controls.Add(this.bttnExport);
   1.128 +            this.Controls.Add(this.cmbXslSelect);
   1.129 +            this.Controls.Add(this.cbApplyTransform);
   1.130 +            this.Controls.Add(this.bttnOutputSelect);
   1.131 +            this.Controls.Add(this.tbOutputFile);
   1.132 +            this.Controls.Add(this.lbTitle);
   1.133 +            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
   1.134 +            this.Name = "FrmXmlExport";
   1.135 +            this.ShowIcon = false;
   1.136 +            this.ShowInTaskbar = false;
   1.137 +            this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
   1.138 +            this.Text = "Export as XML";
   1.139 +            this.TopMost = true;
   1.140 +            this.Load += new System.EventHandler(this.FrmXmlExport_Load);
   1.141 +            this.ResumeLayout(false);
   1.142 +            this.PerformLayout();
   1.143 +
   1.144 +        }
   1.145 +
   1.146 +        #endregion
   1.147 +
   1.148 +        private Windows.Forms.IBBLabel lbTitle;
   1.149 +        private System.Windows.Forms.TextBox tbOutputFile;
   1.150 +        private System.Windows.Forms.SaveFileDialog saveFileDialog1;
   1.151 +        private Windows.Forms.IBBButton bttnOutputSelect;
   1.152 +        private System.Windows.Forms.CheckBox cbApplyTransform;
   1.153 +        private System.Windows.Forms.ComboBox cmbXslSelect;
   1.154 +        private Windows.Forms.IBBButton bttnExport;
   1.155 +        private Windows.Forms.IBBButton bttnCancel;
   1.156 +    }
   1.157 +}
   1.158 \ No newline at end of file
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/FrmXmlExport.cs	Sun Aug 14 23:04:42 2011 -0600
     2.3 @@ -0,0 +1,87 @@
     2.4 +´╗┐using System;
     2.5 +using System.Collections.Generic;
     2.6 +using System.ComponentModel;
     2.7 +using System.Data;
     2.8 +using System.Drawing;
     2.9 +using System.Linq;
    2.10 +using System.Text;
    2.11 +using System.Windows.Forms;
    2.12 +using IBBoard.WarFoundry.API.Objects;
    2.13 +using IBBoard.WarFoundry.API.Exporters;
    2.14 +
    2.15 +namespace IBBoard.WarFoundry.GUI.WinForms
    2.16 +{
    2.17 +    public partial class FrmXmlExport : Form
    2.18 +    {
    2.19 +        Army myArmy = null;
    2.20 +        public FrmXmlExport(Army army)
    2.21 +        {
    2.22 +            InitializeComponent();
    2.23 +            myArmy = army;
    2.24 +        }
    2.25 +
    2.26 +        private void ibbLabel1_Click(object sender, EventArgs e)
    2.27 +        {
    2.28 +
    2.29 +        }
    2.30 +
    2.31 +        private void FrmXmlExport_Load(object sender, EventArgs e)
    2.32 +        {
    2.33 +
    2.34 +        }
    2.35 +
    2.36 +        private void checkBox1_CheckedChanged(object sender, EventArgs e)
    2.37 +        {
    2.38 +
    2.39 +        }
    2.40 +
    2.41 +        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
    2.42 +        {
    2.43 +
    2.44 +        }
    2.45 +
    2.46 +        private void bttnOutputSelect_Click(object sender, EventArgs e)
    2.47 +        {
    2.48 +            SaveFileDialog sfd = new SaveFileDialog();
    2.49 +            sfd.Filter = "XML File|*.xml|HTML File|*.html|XHTML File|*.xhtml";
    2.50 +            sfd.Title = "Save XML output";
    2.51 +            sfd.ShowDialog();
    2.52 +
    2.53 +            if (sfd.FileName != "")
    2.54 +            {
    2.55 +                tbOutputFile.Text = sfd.FileName;
    2.56 +            }
    2.57 +        }
    2.58 +
    2.59 +        private void bttnCancel_Click(object sender, EventArgs e)
    2.60 +        {
    2.61 +            this.DialogResult = DialogResult.Cancel;
    2.62 +            this.Hide();
    2.63 +        }
    2.64 +
    2.65 +        private void bttnExport_Click(object sender, EventArgs e)
    2.66 +        {
    2.67 +            if (cbApplyTransform.Checked)
    2.68 +            {
    2.69 +            }
    2.70 +            else
    2.71 +            {
    2.72 +                WarFoundryXmlWithXslExporter.GetDefault().ExportArmy(myArmy, tbOutputFile.Text);
    2.73 +            }
    2.74 +            
    2.75 +            this.DialogResult = DialogResult.OK;
    2.76 +        }
    2.77 +
    2.78 +        private void tbOutputFile_Change(object sender, EventArgs e)
    2.79 +        {
    2.80 +            if (tbOutputFile.Text != "")
    2.81 +            {
    2.82 +                bttnExport.Enabled = true;
    2.83 +            }
    2.84 +            else
    2.85 +            {
    2.86 +                bttnExport.Enabled = false;
    2.87 +            }
    2.88 +        }
    2.89 +    }
    2.90 +}
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/FrmXmlExport.resx	Sun Aug 14 23:04:42 2011 -0600
     3.3 @@ -0,0 +1,123 @@
     3.4 +´╗┐<?xml version="1.0" encoding="utf-8"?>
     3.5 +<root>
     3.6 +  <!-- 
     3.7 +    Microsoft ResX Schema 
     3.8 +    
     3.9 +    Version 2.0
    3.10 +    
    3.11 +    The primary goals of this format is to allow a simple XML format 
    3.12 +    that is mostly human readable. The generation and parsing of the 
    3.13 +    various data types are done through the TypeConverter classes 
    3.14 +    associated with the data types.
    3.15 +    
    3.16 +    Example:
    3.17 +    
    3.18 +    ... ado.net/XML headers & schema ...
    3.19 +    <resheader name="resmimetype">text/microsoft-resx</resheader>
    3.20 +    <resheader name="version">2.0</resheader>
    3.21 +    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
    3.22 +    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
    3.23 +    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
    3.24 +    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
    3.25 +    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
    3.26 +        <value>[base64 mime encoded serialized .NET Framework object]</value>
    3.27 +    </data>
    3.28 +    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
    3.29 +        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
    3.30 +        <comment>This is a comment</comment>
    3.31 +    </data>
    3.32 +                
    3.33 +    There are any number of "resheader" rows that contain simple 
    3.34 +    name/value pairs.
    3.35 +    
    3.36 +    Each data row contains a name, and value. The row also contains a 
    3.37 +    type or mimetype. Type corresponds to a .NET class that support 
    3.38 +    text/value conversion through the TypeConverter architecture. 
    3.39 +    Classes that don't support this are serialized and stored with the 
    3.40 +    mimetype set.
    3.41 +    
    3.42 +    The mimetype is used for serialized objects, and tells the 
    3.43 +    ResXResourceReader how to depersist the object. This is currently not 
    3.44 +    extensible. For a given mimetype the value must be set accordingly:
    3.45 +    
    3.46 +    Note - application/x-microsoft.net.object.binary.base64 is the format 
    3.47 +    that the ResXResourceWriter will generate, however the reader can 
    3.48 +    read any of the formats listed below.
    3.49 +    
    3.50 +    mimetype: application/x-microsoft.net.object.binary.base64
    3.51 +    value   : The object must be serialized with 
    3.52 +            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
    3.53 +            : and then encoded with base64 encoding.
    3.54 +    
    3.55 +    mimetype: application/x-microsoft.net.object.soap.base64
    3.56 +    value   : The object must be serialized with 
    3.57 +            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
    3.58 +            : and then encoded with base64 encoding.
    3.59 +
    3.60 +    mimetype: application/x-microsoft.net.object.bytearray.base64
    3.61 +    value   : The object must be serialized into a byte array 
    3.62 +            : using a System.ComponentModel.TypeConverter
    3.63 +            : and then encoded with base64 encoding.
    3.64 +    -->
    3.65 +  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    3.66 +    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
    3.67 +    <xsd:element name="root" msdata:IsDataSet="true">
    3.68 +      <xsd:complexType>
    3.69 +        <xsd:choice maxOccurs="unbounded">
    3.70 +          <xsd:element name="metadata">
    3.71 +            <xsd:complexType>
    3.72 +              <xsd:sequence>
    3.73 +                <xsd:element name="value" type="xsd:string" minOccurs="0" />
    3.74 +              </xsd:sequence>
    3.75 +              <xsd:attribute name="name" use="required" type="xsd:string" />
    3.76 +              <xsd:attribute name="type" type="xsd:string" />
    3.77 +              <xsd:attribute name="mimetype" type="xsd:string" />
    3.78 +              <xsd:attribute ref="xml:space" />
    3.79 +            </xsd:complexType>
    3.80 +          </xsd:element>
    3.81 +          <xsd:element name="assembly">
    3.82 +            <xsd:complexType>
    3.83 +              <xsd:attribute name="alias" type="xsd:string" />
    3.84 +              <xsd:attribute name="name" type="xsd:string" />
    3.85 +            </xsd:complexType>
    3.86 +          </xsd:element>
    3.87 +          <xsd:element name="data">
    3.88 +            <xsd:complexType>
    3.89 +              <xsd:sequence>
    3.90 +                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
    3.91 +                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
    3.92 +              </xsd:sequence>
    3.93 +              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
    3.94 +              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
    3.95 +              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
    3.96 +              <xsd:attribute ref="xml:space" />
    3.97 +            </xsd:complexType>
    3.98 +          </xsd:element>
    3.99 +          <xsd:element name="resheader">
   3.100 +            <xsd:complexType>
   3.101 +              <xsd:sequence>
   3.102 +                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
   3.103 +              </xsd:sequence>
   3.104 +              <xsd:attribute name="name" type="xsd:string" use="required" />
   3.105 +            </xsd:complexType>
   3.106 +          </xsd:element>
   3.107 +        </xsd:choice>
   3.108 +      </xsd:complexType>
   3.109 +    </xsd:element>
   3.110 +  </xsd:schema>
   3.111 +  <resheader name="resmimetype">
   3.112 +    <value>text/microsoft-resx</value>
   3.113 +  </resheader>
   3.114 +  <resheader name="version">
   3.115 +    <value>2.0</value>
   3.116 +  </resheader>
   3.117 +  <resheader name="reader">
   3.118 +    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   3.119 +  </resheader>
   3.120 +  <resheader name="writer">
   3.121 +    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   3.122 +  </resheader>
   3.123 +  <metadata name="saveFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
   3.124 +    <value>17, 17</value>
   3.125 +  </metadata>
   3.126 +</root>
   3.127 \ No newline at end of file