blob: a79f3065e64346a5ee17073327031b8be451f44f (
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 System.Net.NetworkInformation;
using MoMoney.Presentation.Model.messages;
using MoMoney.Presentation.Views;
using MoMoney.Presentation.Winforms.Resources;
using MoMoney.Service.Infrastructure.Eventing;
namespace MoMoney.Presentation.Presenters
{
public interface INotificationIconPresenter : IModule,
IEventSubscriber<ClosingTheApplication>,
IEventSubscriber<NewProjectOpened>
{
}
public class NotificationIconPresenter : INotificationIconPresenter
{
readonly INotificationIconView view;
readonly IEventAggregator broker;
public NotificationIconPresenter(INotificationIconView view, IEventAggregator broker)
{
this.view = view;
this.broker = broker;
}
public void run()
{
broker.subscribe_to<ClosingTheApplication>(this);
broker.subscribe_to<NewProjectOpened>(this);
NetworkChange.NetworkAvailabilityChanged += (sender, args) => view.display(ApplicationIcons.Application, args.IsAvailable ? "Connected To A Network" : "Disconnected From Network");
view.display(ApplicationIcons.Application, "mokhan.ca");
}
public void notify(ClosingTheApplication message)
{
view.Dispose();
}
public void notify(NewProjectOpened message)
{
view.opened_new_project();
}
}
}
|