diff options
Diffstat (limited to 'OpenFileGUICommand.cpp')
-rw-r--r-- | OpenFileGUICommand.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/OpenFileGUICommand.cpp b/OpenFileGUICommand.cpp index 4568f61..1ea2c2f 100644 --- a/OpenFileGUICommand.cpp +++ b/OpenFileGUICommand.cpp @@ -2,15 +2,24 @@ #include <string> #include "OpenFileGUICommand.h" +#include "Exception.h" #include "LoadFilesCommand.h" +#include "MuseumPauseCommand.h" #include "View.h" using namespace std; void OpenFileGUICommand::execute() { + Museum * museum = &this->get_museum(); + + MuseumPauseCommand(*museum).set(true); this->get_view().dialog_file([](vector<string> files, void * data) -> void { - auto self = static_cast<OpenFileGUICommand *>(data); - LoadFilesCommand(self).execute(files); - }, this); + Museum * museum = static_cast<Museum *>(data); + try { + LoadFilesCommand(*museum).execute(files); + } catch (Exception & e) { + printf("%s\n", e.what()); + } + }, museum); } |