Mercurial > repos > IBDev-IBBoard.WarFoundry.GUI.GTK
comparison 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 |
comparison
equal
deleted
inserted
replaced
27:83c8945edac2 | 28:9440eef124b0 |
---|---|
13 using IBBoard.IO; | 13 using IBBoard.IO; |
14 using IBBoard.Lang; | 14 using IBBoard.Lang; |
15 using IBBoard.Logging; | 15 using IBBoard.Logging; |
16 using IBBoard.CustomMath; | 16 using IBBoard.CustomMath; |
17 using IBBoard.WarFoundry.API; | 17 using IBBoard.WarFoundry.API; |
18 using IBBoard.WarFoundry.API.Exporters; | |
18 using IBBoard.WarFoundry.API.Factories; | 19 using IBBoard.WarFoundry.API.Factories; |
19 using IBBoard.WarFoundry.API.Factories.Xml; | 20 using IBBoard.WarFoundry.API.Factories.Xml; |
20 using IBBoard.WarFoundry.API.Objects; | 21 using IBBoard.WarFoundry.API.Objects; |
21 using IBBoard.WarFoundry.API.Commands; | 22 using IBBoard.WarFoundry.API.Commands; |
22 using IBBoard.WarFoundry.API.Savers; | 23 using IBBoard.WarFoundry.API.Savers; |
957 if (sender is UnitDisplayWidget) | 958 if (sender is UnitDisplayWidget) |
958 { | 959 { |
959 unitToWidgetMap.Remove(((UnitDisplayWidget)sender).Unit); | 960 unitToWidgetMap.Remove(((UnitDisplayWidget)sender).Unit); |
960 } | 961 } |
961 } | 962 } |
963 | |
964 protected virtual void OnMiExportAsBasicHtmlActivated (object sender, System.EventArgs e) | |
965 { | |
966 FileChooserDialog fileDialog = new FileChooserDialog("Export army", this, FileChooserAction.Save, "Cancel", ResponseType.Cancel, "Export", ResponseType.Accept); | |
967 FileFilter filter = new FileFilter(); | |
968 filter.AddPattern("*.html"); | |
969 filter.Name = "HTML pages (*.html)"; | |
970 fileDialog.AddFilter(filter); | |
971 int response = fileDialog.Run(); | |
972 string filePath = null; | |
973 | |
974 if (response == (int)ResponseType.Accept) | |
975 { | |
976 filePath = fileDialog.Filename; | |
977 } | |
978 | |
979 fileDialog.Hide(); | |
980 fileDialog.Dispose(); | |
981 | |
982 if (filePath != null) | |
983 { | |
984 Army army = WarFoundryCore.CurrentArmy; | |
985 logger.DebugFormat("Exporting {0} to {1} as basic HTML", army.Name, filePath); | |
986 WarFoundryHtmlExporter.GetDefault().ExportArmy(army, filePath); | |
987 } | |
988 } | |
962 } | 989 } |
963 } | 990 } |