public NotifyIconHolder(PresenterServiceProvider serviceProvider) { Debug.Assert(serviceProvider != null, "serviceProvider != null"); _serviceProvider = serviceProvider; _presenter = new appBlocks.NuGenPresenter(serviceProvider); _presenter.ExportDialogIcon = Resources.Bullet; _presenter.ExportDialogShowInTaskbar = true; _presenter.ExportSucceeded += _presenter_ExportSucceeded; _keyInterceptor = new NuGenKeyInterceptor(); _notifyIcon = new NotifyIcon(); _notifyIcon.Icon = Resources.Bullet; _notifyIcon.Text = Resources.Text_NotifyIcon_NuGenPresenter; _zoomInvokeTimer = new Timer(); _zoomInvokeTimer.Tick += _zoomInvokeTimer_Tick; _drawInvokeTimer = new Timer(); _drawInvokeTimer.Tick += _drawInvokeTimer_Tick; _notifyIcon.ContextMenuStrip = this.CreateContextMenuStrip(); _notifyIcon.Visible = true; this.ReadSettings(); }
public void Dispose() { if (_presenter != null) { _presenter.ExportSucceeded -= _presenter_ExportSucceeded; _presenter.Dispose(); _presenter = null; } if (_keyInterceptor != null) { _keyInterceptor.Operations.Clear(); _keyInterceptor.Dispose(); _keyInterceptor = null; } if (_drawInvokeTimer != null) { _drawInvokeTimer.Tick -= _drawInvokeTimer_Tick; _drawInvokeTimer.Dispose(); _drawInvokeTimer = null; } if (_zoomInvokeTimer != null) { _zoomInvokeTimer.Tick -= _zoomInvokeTimer_Tick; _zoomInvokeTimer.Dispose(); _zoomInvokeTimer = null; } if (_aboutMenuItem != null) { _aboutMenuItem.Click -= _aboutMenuItem_Click; _aboutMenuItem.Dispose(); _aboutMenuItem = null; } if (_exitMenuItem != null) { _exitMenuItem.Click -= _exitMenuItem_Click; _exitMenuItem.Dispose(); _exitMenuItem = null; } if (_exportMenuItem != null) { _exportMenuItem.Click -= _exportMenuItem_Click; _exportMenuItem.Dispose(); _exportMenuItem = null; } if (_helpMenuItem != null) { _helpMenuItem.Click -= _helpMenuItem_Click; _helpMenuItem.Dispose(); _helpMenuItem = null; } if (_optionsMenuItem != null) { _optionsMenuItem.Click -= _optionsMenuItem_Click; _optionsMenuItem.Dispose(); _optionsMenuItem = null; } if (_breakTimerMenuItem != null) { _breakTimerMenuItem.Click -= _breakTimerMenuItem_Click; _breakTimerMenuItem.Dispose(); _breakTimerMenuItem = null; } if (_drawMenuItem != null) { _drawMenuItem.Click -= _drawMenuItem_Click; _drawMenuItem.Dispose(); _drawMenuItem = null; } if (_zoomMenuItem != null) { _zoomMenuItem.Click -= _zoomMenuItem_Click; _zoomMenuItem.Dispose(); _zoomMenuItem = null; } if (_notifyIcon != null) { _notifyIcon.Dispose(); _notifyIcon = null; } }