aboutsummaryrefslogtreecommitdiff
path: root/OpenFileGUICommand.cpp
blob: c23a3cf1c60eaa81a81d1461e4a0375b730a8d8a (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;

OpenFileGUICommand::OpenFileGUICommand(Museum & m, View & v) : museum(m), view(v) {}

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