main
1using MoMoney.Presentation.Core;
2using momoney.presentation.model.eventing;
3using momoney.presentation.model.menu.file;
4using MoMoney.Presentation.Views;
5using MoMoney.Service.Infrastructure.Eventing;
6
7namespace momoney.presentation.presenters
8{
9 public interface IApplicationShellPresenter : IPresenter, IEventSubscriber<ClosingProjectEvent>
10 {
11 void shut_down();
12 }
13
14 public class ApplicationShellPresenter : IApplicationShellPresenter
15 {
16 readonly IShell shell;
17 readonly IEventAggregator broker;
18 readonly IExitCommand command;
19
20 public ApplicationShellPresenter(IEventAggregator broker, IShell shell, IExitCommand command)
21 {
22 this.broker = broker;
23 this.command = command;
24 this.shell = shell;
25 }
26
27 public void run()
28 {
29 broker.subscribe(this);
30 shell.attach_to(this);
31 }
32
33 public void notify(ClosingProjectEvent message)
34 {
35 shell.close_all_windows();
36 }
37
38 public void shut_down()
39 {
40 command.run();
41 }
42 }
43}