示例#1
0
 public void Stop()
 {
     _notifyIcon.Visible = false;
     _backgroundService.Stop();
     _backgroundService = null;
     Application.Exit();
 }
示例#2
0
        public ViewManager(BackgroundService backgroundService)
        {
            _backgroundService             = backgroundService;
            _backgroundService.LogChanged += _backgroundService_LogChanged;

            _components = new System.ComponentModel.Container();

            _notifyIcon = new NotifyIcon(_components)
            {
                ContextMenuStrip = new ContextMenuStrip(),
                Icon             = Properties.Resources.QuizBuzzIcon,
                Text             = _backgroundService.BuzzerManager.Buzzers.Count * 4 + " buzzers connected",
                Visible          = true,
            };

            _notifyIcon.ContextMenuStrip.Opening += ContextMenuStrip_Opening;
            _notifyIcon.DoubleClick += NotifyIcon_DoubleClick;
            _notifyIcon.MouseUp     += NotifyIcon_MouseUp;

            _statusViewModel = new ViewModel.StatusViewModel
            {
                Icon = AppIcon
            };

            _hiddenWindow         = new System.Windows.Window();
            _hiddenWindow.Closed += _hiddenWindow_Closed;
            _hiddenWindow.Hide();
        }
示例#3
0
 public STAApplicationContext()
 {
     _backgroundService = new BackgroundService();
     _viewManager       = new ViewManager(_backgroundService);
     _backgroundService.Start();
 }
示例#4
0
 protected override void Dispose(bool disposing)
 {
     _viewManager = null;
     _backgroundService.Stop();
     _backgroundService = null;
 }