main
 1using gorilla.commons.utility;
 2using MoMoney.Presentation.Model.Menu.File;
 3using MoMoney.Presentation.Model.Projects;
 4using momoney.presentation.views;
 5
 6namespace momoney.presentation.model.menu.file
 7{
 8    public interface IOpenCommand : Command, ISaveChangesCallback
 9    {
10    }
11
12    public class OpenCommand : IOpenCommand
13    {
14        readonly ISelectFileToOpenDialog view;
15        readonly IProjectController project;
16        readonly ISaveChangesCommand save_changes_command;
17
18        public OpenCommand(ISelectFileToOpenDialog view, IProjectController project, ISaveChangesCommand save_changes_command)
19        {
20            this.view = view;
21            this.save_changes_command = save_changes_command;
22            this.project = project;
23        }
24
25        public void run()
26        {
27            save_changes_command.run(this);
28        }
29
30        public void saved()
31        {
32            open_project();
33        }
34
35        public void not_saved()
36        {
37            open_project();
38        }
39
40        public void cancelled()
41        {
42        }
43
44        void open_project()
45        {
46            project.open_project_from(view.tell_me_the_path_to_the_file());
47        }
48    }
49}