Example #1
0
        public TrayPresenter(ServiceContainer serviceContainer, UserStateListener userStateListener, IIconFactory trayIconFactory, ITooltipTextFactory tooltipTextFactory)
        {
            _iconFactory       = trayIconFactory;
            _toolTipFactory    = tooltipTextFactory;
            _serviceContainer  = serviceContainer;
            _userStateListener = userStateListener;

            TeamViewModel = new MainWindowViewModel(_serviceContainer.AuthenticationService,
                                                    _serviceContainer.RoomService,
                                                    _serviceContainer.GlobalRoomService,
                                                    _serviceContainer.UserStateService,
                                                    _serviceContainer.UserMessageService);

            _serviceContainer.AuthenticationService.LoginCompleted += HandleLoginCompleted;

            _userStateListener.TimeChanged      += UserStateListenerTimeChanged;
            _userStateListener.UserStateChanged += UserStateListenerUserStateChanged;
        }
Example #2
0
        public SysTrayApp()
        {
            _growlNotifications = new GrowlNotifiactions
            {
                Top  = SystemParameters.WorkArea.Top + TopOffset,
                Left = SystemParameters.WorkArea.Left + SystemParameters.WorkArea.Width - LeftOffset
            };
            //services
            _iconFactory    = new TrayIconFactory();
            _toolTipFactory = new TooltipTextFactory();

            _trayMenu = new ContextMenu();
            PopulateWithPreLoginTrayItems(_trayMenu);

            _notifyIcon = new NotifyIcon
            {
                Text        = _toolTipFactory.Get(TimeWarpState.None, 0),
                Icon        = _iconFactory.Get(TimeWarpState.None),
                ContextMenu = _trayMenu,
                Visible     = true
            };

            var synchronizationContext = SynchronizationContext.Current;

            var serviceContainer  = new ServiceContainer(synchronizationContext);
            var userStateListener = new UserStateListener(serviceContainer.UserStateService,
                                                          synchronizationContext);

            _messagesReceiver = new MessagesReceiver(userStateListener, _growlNotifications, serviceContainer.UserMessageService);
            _trayPresenter    = new TrayPresenter(serviceContainer, userStateListener, _iconFactory, _toolTipFactory);

            _trayPresenter.TooltipTextChanged           += HandleTooltipTextChanged;
            _trayPresenter.ShowPostLoginTrayInformation += HandleLoginCompleted;
            _trayPresenter.ShowBallon     += HandleShowBallon;
            _notifyIcon.Click             += NotifyIconClick;
            _notifyIcon.BalloonTipClicked += NotifyIconBalloonTipClicked;

            ShowMainWindow();
        }