aboutsummaryrefslogtreecommitdiff
path: root/OpenFileGUICommand.cpp
blob: 13751b2a4d723419ef4d5ead010862a5e0b3be42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <vector>
#include <string>

#include "OpenFileGUICommand.h"
#include "Exception.h"
#include "LoadFilesCommand.h"
#include "ToggleMuseumPauseCommand.h"
#include "View.h"

using namespace std;

void OpenFileGUICommand::execute() {
	Museum * museum = &this->get_museum();

	ToggleMuseumPauseCommand(*museum).set(true);
	this->get_view().dialog_file([](vector<string> files, void * data) -> void {
		Museum * museum = static_cast<Museum *>(data);
		try {
			LoadFilesCommand(*museum).execute(files);
		} catch (Exception & e) {
			printf("%s\n", e.what());
		}
	}, museum);
}