/// <summary>
 /// Application Context used for NotifyIcon.
 /// </summary>
 /// <param name="hosts"></param>
 public HostedApplicationContext(IEnumerable <IHost> hosts)
 {
     _host             = new CompositeHost(hosts);
     _notifyIcon       = NotifyIcon.Builder.Build();
     _notifyIcon.Exit += NotifyIcon_Exit;
     Run();
 }
예제 #2
0
        public PresentationController(IEntryPresenter entryPresenter, IReportPresenter reportPresenter, INotifyIcon notifiyIcon)
        {
            _entryPresenter = entryPresenter;
            _reportPresenter = reportPresenter;
            _notifyIcon = notifiyIcon;

            _notifyIcon.ShowReport += OnShowReport;
        }
예제 #3
0
 protected virtual void OnLoaded(object sender, RoutedEventArgs e)
 {
     this.NotifyIcon = ComponentRegistry.Instance.GetComponent <INotifyIcon>();
     if (this.IsEnabled)
     {
         this.Show();
     }
     else
     {
         this.Hide();
     }
 }
예제 #4
0
        public ApplicationModel(INotifyIcon notifyIcon, IMainViewFactory mainViewFactory, ISettingsViewFactory settingsViewFactory)
        {
            _notifyItemSelectedActions = new Dictionary<string, Action>()
            {
                { NotifyIconActions.ShowMainUI.GetDescription(), () => mainViewFactory.Build().Show() },
                { NotifyIconActions.ShowSettingsUI.GetDescription(), () => settingsViewFactory.Build().Show() },
                { NotifyIconActions.ExitApplication.GetDescription(), () => Exit() }
            };

            _notifyIcon = notifyIcon;
            _notifyIcon.ItemSelected += HandleNotifyIconItemSelected;
        }
예제 #5
0
        public TrayApplication([NotNull] IContextMenu contextMenu,
                               [NotNull] IApplication application,
                               [NotNull] IProvideNotifyIcon notifyIconProvider,
                               [NotNull] IProvideIcon trayIconProvider,
                               [CanBeNull] IRunTheBackgroundTrayApp background = null,
                               [CanBeNull] EventHandler doubleClickAction      = null)
        {
            m_contextMenu        = contextMenu ?? throw new ArgumentNullException(nameof(contextMenu));
            m_application        = application ?? throw new ArgumentNullException(nameof(application));
            m_notifyIconProvider = notifyIconProvider ?? throw new ArgumentNullException(nameof(notifyIconProvider));
            m_trayIconProvider   = trayIconProvider ?? throw new ArgumentNullException(nameof(trayIconProvider));
            m_background         = background;

            m_notifyIcon             = m_notifyIconProvider.Provide();
            m_application.Exit      += ApplicationOnExit;
            m_notifyIcon.Visible     = true;
            m_notifyIcon.ContextMenu = m_contextMenu;
            if (doubleClickAction != null)
            {
                m_notifyIcon.DoubleClick += doubleClickAction;
            }
        }
 public void SetUp()
 {
     _notifyIcon = MockRepository.GenerateMock<INotifyIcon>();
 }
예제 #7
0
 public NotifyIconPresenter(INotifyIcon notifyIcon)
 {
     _notifyIcon = notifyIcon;
 }
예제 #8
0
 public PresentationController(INotifyIcon notifyIcon)
 {
     _notifyIcon = notifyIcon;
 }