public HostNotifyIcon(NotifyIconOptions options) { _options = options; _notifyIcon = new System.Windows.Forms.NotifyIcon() { Icon = _options.Icon, BalloonTipTitle = _options.Title, Text = _options.Title, Visible = true }; BuildMenu(); _notifyIcon.DoubleClick += NotifyIconOnDoubleClick; }
/// <summary> /// Returns an <see cref="INotifyIcon"/>. . will return the same instance if build has already been called. /// </summary> /// <returns></returns> public INotifyIcon Build() { if (_isBuilt) { throw new InvalidOperationException("Build can only be called once."); } var options = new NotifyIconOptions(); foreach (var configAction in _configureNotifyTrayConfigActions) { configAction(options); } NotifyIcon.InternalNotifyIcon = new HostNotifyIcon(options); _isBuilt = true; return(NotifyIcon.InternalNotifyIcon); }