main
1using gorilla.commons.utility;
2using MoMoney.Presentation.Core;
3using momoney.presentation.model.eventing;
4using MoMoney.Presentation.Model.Menu.File;
5using MoMoney.Service.Infrastructure.Eventing;
6
7namespace momoney.presentation.model.menu.file
8{
9 public interface IExitCommand : Command, ISaveChangesCallback
10 {
11 }
12
13 public class ExitCommand : IExitCommand
14 {
15 readonly IApplication application;
16 readonly IEventAggregator broker;
17 readonly ISaveChangesCommand command;
18
19 public ExitCommand(IApplication application, IEventAggregator broker, ISaveChangesCommand command)
20 {
21 this.application = application;
22 this.command = command;
23 this.broker = broker;
24 }
25
26 public void run()
27 {
28 command.run(this);
29 }
30
31 public void saved()
32 {
33 shut_down();
34 }
35
36 public void not_saved()
37 {
38 shut_down();
39 }
40
41 public void cancelled()
42 {
43 }
44
45 void shut_down()
46 {
47 broker.publish<ClosingTheApplication>();
48 application.shut_down();
49 }
50 }
51}