public TomightyApplication() { var eventHub = new SynchronousEventHub(); var timer = new Tomighty.Timer(eventHub); var userPreferences = new UserPreferences(); var pomodoroEngine = new PomodoroEngine(timer, userPreferences, eventHub); var trayMenu = new TrayMenu() as ITrayMenu; var trayIcon = CreateTrayIcon(trayMenu); var timerWindowPresenter = new TimerWindowPresenter(pomodoroEngine, timer, eventHub); new TrayIconController(trayIcon, timerWindowPresenter, eventHub); new TrayMenuController(trayMenu, this, pomodoroEngine, eventHub); new NotificationsPresenter(pomodoroEngine, userPreferences, eventHub); new SoundNotificationPlayer(userPreferences, eventHub); new AutoUpdate(userPreferences).Start(); var aboutWindowPresenter = new AboutWindowPresenter(); var userPreferencesPresenter = new UserPreferencesPresenter(userPreferences); trayMenu.OnAboutClick((sender, e) => aboutWindowPresenter.Show()); trayMenu.OnPreferencesClick((sender, e) => userPreferencesPresenter.Show()); ThreadExit += (sender, e) => trayIcon.Dispose(); new StartupEvents(eventHub); }
public TrayIconController(NotifyIcon notifyIcon, TimerWindowPresenter timerWindowPresenter, IEventHub eventHub) { this.notifyIcon = notifyIcon; this.timerWindowPresenter = timerWindowPresenter; notifyIcon.Click += OnNotifyIconClick; eventHub.Subscribe <TimerStarted>(OnTimerStarted); eventHub.Subscribe <TimerStopped>(OnTimerStopped); }