/// <summary>
        /// Creates the presenter with a primary icon to display in the notification area.
        /// </summary>
        /// <param name="icon">The icon to use at first display.</param>
        public NotifyIconPresenter(ImageSource icon)
        {
            _icon = new NotifyIcon();
            SetIcon(icon);

            //set to hidden because the icon is not part of the visual tree.
            //to hide (close), put visibility to "Collapsed".
            _icon.Visibility = Visibility.Hidden;

            _icon.MouseClick += new System.Windows.Input.MouseButtonEventHandler(_icon_MouseClick);
            _icon.MouseDoubleClick += new System.Windows.Input.MouseButtonEventHandler(_icon_MouseDoubleClick);
            _icon.BalloonTipClick += new RoutedEventHandler(_icon_BalloonTipClick);

        }
Example #2
0
            internal NotifyIconHwndSource(NotifyIcon component)
                : base(0, 0, 0, 0, 0, null, IntPtr.Zero)
            {
                _reference = component;

                AddHook(_reference.WndProc);
            }