summaryrefslogtreecommitdiff
path: root/product/Presentation/Presenters/RestartCommand.cs
blob: 2c2b4f5e1fe374e079c57dfabb5aff357cd46c51 (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
using Gorilla.Commons.Utility.Core;
using MoMoney.Presentation.Core;
using MoMoney.Presentation.Model.messages;
using MoMoney.Service.Infrastructure.Eventing;

namespace MoMoney.Presentation.Presenters.Commands
{
    public interface IRestartCommand : ICommand
    {
    }

    public class RestartCommand : IRestartCommand
    {
        readonly IApplication application;
        readonly IEventAggregator broker;

        public RestartCommand(IApplication application, IEventAggregator broker)
        {
            this.application = application;
            this.broker = broker;
        }

        public void run()
        {
            broker.publish<ClosingTheApplication>();
            application.restart();
        }
    }
}