Mercurial > repos > IBDev-IBBoard.WarFoundry.GUI.WinForms
annotate FrmXmlExport.cs @ 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 |
rev | line source |
---|---|
213 | 1 using System; |
2 using System.Collections.Generic; | |
3 using System.ComponentModel; | |
4 using System.Data; | |
5 using System.Drawing; | |
6 using System.Linq; | |
7 using System.Text; | |
214
a6ce13e4ae89
Near Final XSL output
Dan.Kulinski@dank-laptop.Global.Local
parents:
213
diff
changeset
|
8 using System.IO; |
213 | 9 using System.Windows.Forms; |
10 using IBBoard.WarFoundry.API.Objects; | |
11 using IBBoard.WarFoundry.API.Exporters; | |
12 | |
13 namespace IBBoard.WarFoundry.GUI.WinForms | |
14 { | |
15 public partial class FrmXmlExport : Form | |
16 { | |
17 Army myArmy = null; | |
18 public FrmXmlExport(Army army) | |
19 { | |
20 InitializeComponent(); | |
21 myArmy = army; | |
22 } | |
23 | |
24 private void FrmXmlExport_Load(object sender, EventArgs e) | |
25 { | |
214
a6ce13e4ae89
Near Final XSL output
Dan.Kulinski@dank-laptop.Global.Local
parents:
213
diff
changeset
|
26 tbXslPath.Text = Directory.GetCurrentDirectory() + "\\xsl\\default_html.xsl"; |
213 | 27 } |
28 | |
29 private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) | |
30 { | |
31 | |
32 } | |
33 | |
34 private void bttnOutputSelect_Click(object sender, EventArgs e) | |
35 { | |
36 SaveFileDialog sfd = new SaveFileDialog(); | |
37 sfd.Filter = "XML File|*.xml|HTML File|*.html|XHTML File|*.xhtml"; | |
38 sfd.Title = "Save XML output"; | |
39 sfd.ShowDialog(); | |
40 | |
41 if (sfd.FileName != "") | |
42 { | |
43 tbOutputFile.Text = sfd.FileName; | |
44 } | |
45 } | |
46 | |
47 private void bttnCancel_Click(object sender, EventArgs e) | |
48 { | |
49 this.DialogResult = DialogResult.Cancel; | |
50 this.Hide(); | |
51 } | |
52 | |
53 private void bttnExport_Click(object sender, EventArgs e) | |
54 { | |
55 if (cbApplyTransform.Checked) | |
56 { | |
214
a6ce13e4ae89
Near Final XSL output
Dan.Kulinski@dank-laptop.Global.Local
parents:
213
diff
changeset
|
57 WarFoundryXmlWithXslExporter.GetDefault().ExportArmyWithTransform(myArmy, tbOutputFile.Text, tbXslPath.Text); |
213 | 58 } |
59 else | |
60 { | |
61 WarFoundryXmlWithXslExporter.GetDefault().ExportArmy(myArmy, tbOutputFile.Text); | |
62 } | |
63 | |
64 this.DialogResult = DialogResult.OK; | |
214
a6ce13e4ae89
Near Final XSL output
Dan.Kulinski@dank-laptop.Global.Local
parents:
213
diff
changeset
|
65 this.Hide(); |
213 | 66 } |
67 | |
68 private void tbOutputFile_Change(object sender, EventArgs e) | |
69 { | |
70 if (tbOutputFile.Text != "") | |
71 { | |
72 bttnExport.Enabled = true; | |
73 } | |
74 else | |
75 { | |
76 bttnExport.Enabled = false; | |
77 } | |
78 } | |
214
a6ce13e4ae89
Near Final XSL output
Dan.Kulinski@dank-laptop.Global.Local
parents:
213
diff
changeset
|
79 |
a6ce13e4ae89
Near Final XSL output
Dan.Kulinski@dank-laptop.Global.Local
parents:
213
diff
changeset
|
80 private void cbApplyTransform_CheckedChanged(object sender, EventArgs e) |
a6ce13e4ae89
Near Final XSL output
Dan.Kulinski@dank-laptop.Global.Local
parents:
213
diff
changeset
|
81 { |
a6ce13e4ae89
Near Final XSL output
Dan.Kulinski@dank-laptop.Global.Local
parents:
213
diff
changeset
|
82 if (cbApplyTransform.Checked) |
a6ce13e4ae89
Near Final XSL output
Dan.Kulinski@dank-laptop.Global.Local
parents:
213
diff
changeset
|
83 { |
a6ce13e4ae89
Near Final XSL output
Dan.Kulinski@dank-laptop.Global.Local
parents:
213
diff
changeset
|
84 tbXslPath.Enabled = true; |
a6ce13e4ae89
Near Final XSL output
Dan.Kulinski@dank-laptop.Global.Local
parents:
213
diff
changeset
|
85 bttnXslSelect.Enabled = true; |
a6ce13e4ae89
Near Final XSL output
Dan.Kulinski@dank-laptop.Global.Local
parents:
213
diff
changeset
|
86 } |
a6ce13e4ae89
Near Final XSL output
Dan.Kulinski@dank-laptop.Global.Local
parents:
213
diff
changeset
|
87 else |
a6ce13e4ae89
Near Final XSL output
Dan.Kulinski@dank-laptop.Global.Local
parents:
213
diff
changeset
|
88 { |
a6ce13e4ae89
Near Final XSL output
Dan.Kulinski@dank-laptop.Global.Local
parents:
213
diff
changeset
|
89 tbXslPath.Enabled = false; |
a6ce13e4ae89
Near Final XSL output
Dan.Kulinski@dank-laptop.Global.Local
parents:
213
diff
changeset
|
90 bttnXslSelect.Enabled = false; |
a6ce13e4ae89
Near Final XSL output
Dan.Kulinski@dank-laptop.Global.Local
parents:
213
diff
changeset
|
91 } |
a6ce13e4ae89
Near Final XSL output
Dan.Kulinski@dank-laptop.Global.Local
parents:
213
diff
changeset
|
92 } |
a6ce13e4ae89
Near Final XSL output
Dan.Kulinski@dank-laptop.Global.Local
parents:
213
diff
changeset
|
93 |
a6ce13e4ae89
Near Final XSL output
Dan.Kulinski@dank-laptop.Global.Local
parents:
213
diff
changeset
|
94 private void bttnXslSelect_Click(object sender, EventArgs e) |
a6ce13e4ae89
Near Final XSL output
Dan.Kulinski@dank-laptop.Global.Local
parents:
213
diff
changeset
|
95 { |
a6ce13e4ae89
Near Final XSL output
Dan.Kulinski@dank-laptop.Global.Local
parents:
213
diff
changeset
|
96 OpenFileDialog ofd = new OpenFileDialog(); |
a6ce13e4ae89
Near Final XSL output
Dan.Kulinski@dank-laptop.Global.Local
parents:
213
diff
changeset
|
97 |
a6ce13e4ae89
Near Final XSL output
Dan.Kulinski@dank-laptop.Global.Local
parents:
213
diff
changeset
|
98 ofd.InitialDirectory = Directory.GetCurrentDirectory() + "\\xsl"; |
a6ce13e4ae89
Near Final XSL output
Dan.Kulinski@dank-laptop.Global.Local
parents:
213
diff
changeset
|
99 ofd.Filter = "XSL Files|*.xsl"; |
a6ce13e4ae89
Near Final XSL output
Dan.Kulinski@dank-laptop.Global.Local
parents:
213
diff
changeset
|
100 DialogResult result = ofd.ShowDialog(); |
a6ce13e4ae89
Near Final XSL output
Dan.Kulinski@dank-laptop.Global.Local
parents:
213
diff
changeset
|
101 |
a6ce13e4ae89
Near Final XSL output
Dan.Kulinski@dank-laptop.Global.Local
parents:
213
diff
changeset
|
102 if (result == DialogResult.OK) |
a6ce13e4ae89
Near Final XSL output
Dan.Kulinski@dank-laptop.Global.Local
parents:
213
diff
changeset
|
103 { |
a6ce13e4ae89
Near Final XSL output
Dan.Kulinski@dank-laptop.Global.Local
parents:
213
diff
changeset
|
104 tbXslPath.Text = ofd.FileName; |
a6ce13e4ae89
Near Final XSL output
Dan.Kulinski@dank-laptop.Global.Local
parents:
213
diff
changeset
|
105 } |
a6ce13e4ae89
Near Final XSL output
Dan.Kulinski@dank-laptop.Global.Local
parents:
213
diff
changeset
|
106 |
a6ce13e4ae89
Near Final XSL output
Dan.Kulinski@dank-laptop.Global.Local
parents:
213
diff
changeset
|
107 } |
213 | 108 } |
109 } |