public static void ShowBalloonTip(string title, string content, NotifyIconInfoType infoType, string token) { if (NotifyIconDic.TryGetValue(token, out var notifyIcon)) { notifyIcon.ShowBalloonTip(title, content, infoType); } }
public void ShowBalloonTip(string title, string content, NotifyIconInfoType infoType) { if (!_added || DesignerHelper.IsInDesignMode) { return; } var data = new InteropValues.NOTIFYICONDATA { uFlags = InteropValues.NIF_INFO, hWnd = _messageWindowHandle, uID = _id, szInfoTitle = title ?? string.Empty, szInfo = content ?? string.Empty }; switch (infoType) { case NotifyIconInfoType.Info: data.dwInfoFlags = InteropValues.NIIF_INFO; break; case NotifyIconInfoType.Warning: data.dwInfoFlags = InteropValues.NIIF_WARNING; break; case NotifyIconInfoType.Error: data.dwInfoFlags = InteropValues.NIIF_ERROR; break; case NotifyIconInfoType.None: data.dwInfoFlags = InteropValues.NIIF_NONE; break; } InteropMethods.Shell_NotifyIcon(InteropValues.NIM_MODIFY, data); }