Exemple #1
0
        public bool RemoveMenuItem(NotificationMenuItem menuItem)
        {
            if (_menuPtr == IntPtr.Zero)
            {
                return(false);
            }

            if (TrayMenuItemRemoveMenuItem(_menuPtr, menuItem.GetHandle()))
            {
                MenuItems.Remove(menuItem);
                return(true);
            }

            return(false);
        }
        /// <summary>
        /// Adds a menu item to the tray icon menu. Creates a menu if none
        /// is present.
        /// </summary>
        /// <param name="menuItem">Menu item to add to the icon menu.</param>
        /// <returns>true success, false otherwise</returns>
        public bool AddMenuItem(NotificationMenuItem menuItem)
        {
            if (_iconPtr == IntPtr.Zero)
            {
                return(false);
            }

            if (TrayIconAddMenuItem(_iconPtr, menuItem.GetHandle()))
            {
                MenuItems.Add(menuItem);
                return(true);
            }

            return(false);
        }