main
1using momoney.presentation.model.eventing;
2using MoMoney.Presentation.Model.Menu;
3using momoney.presentation.presenters;
4using MoMoney.Presentation.Presenters;
5using MoMoney.Service.Infrastructure.Eventing;
6
7namespace MoMoney.Modules
8{
9 public class ApplicationMenuModule : IApplicationMenuModule
10 {
11 readonly IEventAggregator broker;
12 readonly IRunPresenterCommand command;
13
14 public ApplicationMenuModule(IEventAggregator broker, IRunPresenterCommand command)
15 {
16 this.broker = broker;
17 this.command = command;
18 }
19
20 public void run()
21 {
22 broker.subscribe(this);
23 command.run<IApplicationMenuPresenter>();
24 }
25
26 public void notify(NewProjectOpened message)
27 {
28 broker.publish<IMenuItem>(x => x.refresh());
29 }
30
31 public void notify(ClosingProjectEvent message)
32 {
33 broker.publish<IMenuItem>(x => x.refresh());
34 }
35
36 public void notify(SavedChangesEvent message)
37 {
38 broker.publish<IMenuItem>(x => x.refresh());
39 }
40
41 public void notify(UnsavedChangesEvent message)
42 {
43 broker.publish<IMenuItem>(x => x.refresh());
44 }
45 }
46}