summaryrefslogtreecommitdiff
path: root/product/Boot/Modules/GettingStartedModule.cs
blob: 3428bb64c6ed389066b54d911d378967926fed85 (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using MoMoney.Presentation;
using momoney.presentation.model.eventing;
using momoney.presentation.presenters;
using MoMoney.Presentation.Presenters;
using MoMoney.Service.Infrastructure.Eventing;

namespace MoMoney.Modules
{
    public interface IGettingStartedModule : IModule,
                                             IEventSubscriber<NewProjectOpened>,
                                             IEventSubscriber<ClosingProjectEvent>
    {
    }

    public class GettingStartedModule : IGettingStartedModule
    {
        readonly IEventAggregator broker;
        readonly IRunPresenterCommand command;

        public GettingStartedModule(IEventAggregator broker, IRunPresenterCommand command)
        {
            this.broker = broker;
            this.command = command;
        }

        public void run()
        {
            broker.subscribe(this);
            command.run<IGettingStartedPresenter>();
        }

        public void notify(NewProjectOpened message)
        {
            command.run<IGettingStartedPresenter>();
        }

        public void notify(ClosingProjectEvent message)
        {
            command.run<IGettingStartedPresenter>();
        }
    }
}