blob: 474b5f68f69cce3f8d8e7744857dfb600c9969c1 (
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
45
46
47
48
49
50
51
52
53
54
55
|
using Gorilla.Commons.Utility.Extensions;
using MoMoney.Presentation.Model.messages;
using MoMoney.Presentation.Views.Shell;
using MoMoney.Service.Infrastructure.Eventing;
namespace MoMoney.Presentation.Presenters.Shell
{
public interface ITaskTrayPresenter : IModule,
IEventSubscriber<SavedChangesEvent>,
IEventSubscriber<StartedRunningCommand>,
IEventSubscriber<FinishedRunningCommand>,
IEventSubscriber<NewProjectOpened>
{
}
public class TaskTrayPresenter : ITaskTrayPresenter
{
readonly ITaskTrayMessageView view;
readonly IEventAggregator broker;
public TaskTrayPresenter(ITaskTrayMessageView view, IEventAggregator broker)
{
this.view = view;
this.broker = broker;
}
public void run()
{
view.display("Welcome!");
view.display("Visit http://mokhan.ca for more information!");
broker.subscribe_to<SavedChangesEvent>(this);
broker.subscribe_to<NewProjectOpened>(this);
}
public void notify(SavedChangesEvent message)
{
view.display("successfully saved changes");
}
public void notify(NewProjectOpened message)
{
view.display("opened {0}", message.path);
}
public void notify(StartedRunningCommand message)
{
view.display("Running... {0}".formatted_using(message.running_action));
}
public void notify(FinishedRunningCommand message)
{
view.display("Finished... {0}".formatted_using(message.completed_action));
}
}
}
|