void ExecuteCommandSaveProject(object o) { try { var si = new SaveItem(); si.Layer = HeightmapPresenter.HeightmapLayer; si.World = FieldPresenter.World; var sPath = MasterView.GetSaveFilePath(); SaveLoadManager.Save(si, sPath); MasterView.ShowInfoOKMessage("Saved"); } catch (XmlException xe) { MasterView.ShowErrorOKMessage("Not saved due to xml error: " + xe.Message); } catch (InvalidOperationException ioe) { MasterView.ShowErrorOKMessage("Not saved due to Invalid Operation: " + ioe.Message); } catch (IOException ie) { MasterView.ShowErrorOKMessage("Not saved due to IO error: " + ie.Message); } catch (Exception e) { MasterView.ShowErrorOKMessage("Not saved due to: " + e.Message); } }
void ExecuteCommandExportToTxt(object o) { if (HeightmapPresenter.HeightmapLayer == null) { MasterView.ShowErrorOKMessage("No heightmap rendered yet"); return; } try { IExportManager exportMgr = new ExportManager(); var path = MasterView.GetSaveFilePath(); var layer = this.HeightmapPresenter.HeightmapLayer; exportMgr.ExportToFile(path, layer, MinHeight, MaxHeight); MasterView.ShowInfoOKMessage("Exported"); } catch (IOException e) { MasterView.ShowErrorOKMessage(e.Message); } }