public NotificationMenuItem(string text) { _menuPtr = TrayMenuItemCreate(text); if (_menuPtr == IntPtr.Zero) { return; } _text = text; _callbackDelegate = HandleMenuItemSelected; TrayMenuItemSetSelectedCallback(_menuPtr, _callbackDelegate); }
/// <summary> /// Notification Tray Icon Constructor, supplying a path to the Icon will /// set it. Passing null and calling Set Icon allows you to set one later. /// OSX Aceepts: PNGs, and JPGs, Recommended size 20x20px or smaller /// Windows Accepts: ICO icon files, recommended size, something that scales nice. /// </summary> /// <param name="iconPath"></param> public NotificationIcon(string iconPath) { _iconPtr = TrayIconCreate(); if (_iconPtr == null) { return; } /// Native code will not hold a reference to the delegate /// don't think you're smart and remove this, the delegate will /// get garbage collected if you do, and then you'll get intermittent /// crashes :-( _callbackDelegate = HandleMenuItemSelected; TrayIconInitialize(_iconPtr, iconPath); TrayIconSetSelectedCallback(_iconPtr, _callbackDelegate); }
public void TrayMenuItemSetSelectedCallback(IntPtr menuItemHandle, MenuItemSelectedEventCallback menuItemSelectedEventCallback) { TrayMenuItem_SetSelectedCallback(menuItemHandle, menuItemSelectedEventCallback); }
public void TrayIconSetSelectedCallback(IntPtr iconHandle, MenuItemSelectedEventCallback menuItemSelectedEventCallback) { TrayIcon_SetSelectedCallback(iconHandle, menuItemSelectedEventCallback); }
private static extern void TrayMenuItem_SetSelectedCallback(IntPtr menuItemHandle, MenuItemSelectedEventCallback menuItemSelectedEventCallback);
public static void TrayMenuItemSetSelectedCallback(IntPtr menuItemHandle, MenuItemSelectedEventCallback menuItemSelectedEventCallback) { Initialize(); _impl.TrayMenuItemSetSelectedCallback(menuItemHandle, menuItemSelectedEventCallback); }