comparison FrmExportXml.cs @ 124:a647afc19fe9

Re #361: Add XML export UI to GTK# * Add sensitivity changing on OK button * Need to make buttons do things, and allow creating new files with file chooser
author IBBoard <dev@ibboard.co.uk>
date Wed, 28 Sep 2011 21:01:54 +0100
parents 2479414b16f6
children 42d2aa87dfa7
comparison
equal deleted inserted replaced
123:f58f69ea2435 124:a647afc19fe9
12 { 12 {
13 public FrmExportXml() 13 public FrmExportXml()
14 { 14 {
15 this.Build(); 15 this.Build();
16 FillXsltList(); 16 FillXsltList();
17 saveAsPath.SetCurrentFolder(Environment.GetFolderPath(Environment.SpecialFolder.Personal));
17 } 18 }
18 19
19 private void FillXsltList() 20 private void FillXsltList()
20 { 21 {
21 DirectoryInfo dir = new DirectoryInfo(System.IO.Path.Combine(Constants.ExecutablePath, "xsl")); 22 DirectoryInfo dir = new DirectoryInfo(System.IO.Path.Combine(Constants.ExecutablePath, "xsl"));
22 List<FileInfo> files = new List<FileInfo>(dir.GetFiles("*.xsl")); 23 List<FileInfo> files = new List<FileInfo>(dir.GetFiles("*.xsl"));
23 ComboBoxUtils.FillCombo(transformList, files, delegate(FileInfo file) { return file.Name; }); 24 ComboBoxUtils.FillCombo(transformList, files, delegate(FileInfo file) { return file.Name; });
24 } 25 }
25 26
26 protected void OnDoTransformWidgetToggled (object sender, System.EventArgs e) 27 protected void OnDoTransformWidgetToggled(object sender, System.EventArgs e)
27 { 28 {
28 bool enabled = doTransformWidget.Active; 29 bool enabled = doTransformWidget.Active;
29 lblTransform.Sensitive = enabled; 30 lblTransform.Sensitive = enabled;
30 transformList.Sensitive = enabled; 31 transformList.Sensitive = enabled;
32 SetOkayButtonSensitive();
33 }
34
35 private void SetOkayButtonSensitive()
36 {
37 buttonOk.Sensitive = saveAsPath.Filename != null && (!doTransformWidget.Active || ComboBoxUtils.GetSelectedItem<FileInfo>(transformList) != null);
38 }
39
40 protected void OnTransformListChanged(object sender, System.EventArgs e)
41 {
42 SetOkayButtonSensitive();
43 }
44
45 protected void OnSaveAsPathSelectionChanged(object sender, System.EventArgs e)
46 {
47 SetOkayButtonSensitive();
31 } 48 }
32 } 49 }
33 } 50 }
34 51