public void Stop() { _notifyIcon.Visible = false; _backgroundService.Stop(); _backgroundService = null; Application.Exit(); }
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(); }
public STAApplicationContext() { _backgroundService = new BackgroundService(); _viewManager = new ViewManager(_backgroundService); _backgroundService.Start(); }
protected override void Dispose(bool disposing) { _viewManager = null; _backgroundService.Stop(); _backgroundService = null; }