summaryrefslogtreecommitdiff
path: root/product/Presentation/Presenters/SplashScreenPresenter.cs
blob: 9416ba7abbe01b47f3e244333f31391b9e78069d (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
43
44
using MoMoney.Presentation.Views;
using MoMoney.Presentation.Winforms.Views;
using MoMoney.Service.Infrastructure.Threading;
using MoMoney.Utility.Core;

namespace MoMoney.Presentation.Presenters
{
    public interface ISplashScreenPresenter : IDisposableCommand, ITimerClient
    {
    }

    public class SplashScreenPresenter : ISplashScreenPresenter
    {
        readonly ITimer timer;
        readonly ISplashScreenView view;
        ISplashScreenState current_state;

        public SplashScreenPresenter() : this(new IntervalTimer(), new SplashScreenView())
        {
        }

        public SplashScreenPresenter(ITimer timer, ISplashScreenView view)
        {
            this.timer = timer;
            this.view = view;
        }

        public void run()
        {
            view.display();
            current_state = new display_the_splash_screen(timer, view, this);
        }

        public void Dispose()
        {
            current_state = new hide_the_splash_screen(timer, view, this);
        }

        public void notify()
        {
            current_state.update();
        }
    }
}