Esempio n. 1
0
        public TranslatorBootstrapper(MainWindow mainWindow,
                                      GrowlNotifiactions growlNotifications,
                                      IStartupConfiguration startupConfiguration,
                                      ICacheManager cacheManager)
        {
            if (mainWindow == null)
            {
                throw new ArgumentNullException(nameof(mainWindow));
            }

            if (growlNotifications == null)
            {
                throw new ArgumentNullException(nameof(growlNotifications));
            }

            if (startupConfiguration == null)
            {
                throw new ArgumentNullException(nameof(startupConfiguration));
            }

            if (cacheManager == null)
            {
                throw new ArgumentNullException(nameof(cacheManager));
            }

            this.mainWindow           = mainWindow;
            this.growlNotifications   = growlNotifications;
            this.startupConfiguration = startupConfiguration;
            this.cacheManager         = cacheManager;
            cache = this.cacheManager.GetCacheEnvironment <string, TranslateResult[]>(CacheNames.MeanCache);
        }
Esempio n. 2
0
 public MessagesReceiver(IUserStateListener userStateListener, GrowlNotifiactions growlNotifiactions, IUiUserMessageService uiUserMessageService)
 {
     _userStateListener    = userStateListener;
     _growlNotifiactions   = growlNotifiactions;
     _uiUserMessageService = uiUserMessageService;
     _userStateListener.UserStateChanged    += HandleStateChanged;
     _uiUserMessageService.ReceivedMessages += HandleUserMessageServiceReceivedMessages;
 }
        public TranslatorBootstrapper(MainWindow mainWindow, GrowlNotifiactions growlNotifications, IStartupConfiguration startupConfiguration, ICacheManager cacheManager)
        {
            if (mainWindow == null)
                throw new ArgumentNullException(nameof(mainWindow));

            if (growlNotifications == null)
                throw new ArgumentNullException(nameof(growlNotifications));

            if (startupConfiguration == null)
                throw new ArgumentNullException(nameof(startupConfiguration));

            if (cacheManager == null)
                throw new ArgumentNullException(nameof(cacheManager));

            this.mainWindow = mainWindow;
            this.growlNotifications = growlNotifications;
            this.startupConfiguration = startupConfiguration;
            this.cacheManager = cacheManager;
            cache = this.cacheManager.GetCacheEnvironment<string, TranslateResult[]>(CacheNames.MeanCache);
        }
Esempio n. 4
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();
        }