view FrmXmlExport.cs @ 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
children a6ce13e4ae89
line wrap: on
line source

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;
            }
        }
    }
}