Mercurial > repos > IBDev-IBBoard.WarFoundry.GUI.GTK
diff FrmMainWindow.cs @ 28:9440eef124b0
Closes #69: Add "export" UI
* Add base menu for exports (will be populated automatically once exports are plugins)
* Add menu item for "Basic HTML"
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Tue, 01 Sep 2009 19:10:13 +0000 |
parents | 83c8945edac2 |
children | 2e5448a662b6 |
line wrap: on
line diff
--- a/FrmMainWindow.cs Fri Aug 28 18:52:34 2009 +0000 +++ b/FrmMainWindow.cs Tue Sep 01 19:10:13 2009 +0000 @@ -15,6 +15,7 @@ using IBBoard.Logging; using IBBoard.CustomMath; using IBBoard.WarFoundry.API; +using IBBoard.WarFoundry.API.Exporters; using IBBoard.WarFoundry.API.Factories; using IBBoard.WarFoundry.API.Factories.Xml; using IBBoard.WarFoundry.API.Objects; @@ -959,5 +960,31 @@ unitToWidgetMap.Remove(((UnitDisplayWidget)sender).Unit); } } + + protected virtual void OnMiExportAsBasicHtmlActivated (object sender, System.EventArgs e) + { + FileChooserDialog fileDialog = new FileChooserDialog("Export army", this, FileChooserAction.Save, "Cancel", ResponseType.Cancel, "Export", ResponseType.Accept); + FileFilter filter = new FileFilter(); + filter.AddPattern("*.html"); + filter.Name = "HTML pages (*.html)"; + fileDialog.AddFilter(filter); + int response = fileDialog.Run(); + string filePath = null; + + if (response == (int)ResponseType.Accept) + { + filePath = fileDialog.Filename; + } + + fileDialog.Hide(); + fileDialog.Dispose(); + + if (filePath != null) + { + Army army = WarFoundryCore.CurrentArmy; + logger.DebugFormat("Exporting {0} to {1} as basic HTML", army.Name, filePath); + WarFoundryHtmlExporter.GetDefault().ExportArmy(army, filePath); + } + } } }