/// <summary> /// Show a balloon notification popup. /// </summary> /// <param name="notificationTitle">Balloon title.</param> /// <param name="notificationText">Text to show inside the balloon.</param> /// <param name="icon">Type of the icon to show.</param> /// <param name="timeoutMiliseconds">Timeout in miliseconds after which the balloon will be hidden.</param> /// <param name="clickEvent">Click event handler type when the balloon is clicked.</param> public void ShowNotification(string notificationTitle, string notificationText, ToastIconType icon, int timeoutMiliseconds = DefaultBalloonTipTimeout, ToastClickEvent clickEvent = ToastClickEvent.None) { notifyIcon.ShowBalloonTip(timeoutMiliseconds, notificationTitle, notificationText, icon, clickEvent); }
/// <summary> /// Shows a balloon tip/toast in the system tray. /// </summary> /// <param name="timeout">Number of miliseconds after which the tip is hidden.</param> /// <param name="tipTitle">Title of the balloon/toast.</param> /// <param name="tipText">Contents of the balloon/toast.</param> /// <param name="icon">Icon accompanying the popup balloon/toast.</param> /// <param name="clickEvent">Click event handler for the popup balloon/toast.</param> public void ShowBalloonTip(int timeout, string tipTitle, string tipText, ToastIconType icon, ToastClickEvent clickEvent) { var nIconData = new Windows.Shell32Structures.NotifyIconData { CallbackMessage = (int)clickEvent, Handle = hWnd, UId = uId, Flags = (int)Shell32.NotifyIconFlags.NifMessage | (int)Shell32.NotifyIconFlags.NifInfo, Timeout = timeout, InfoTitle = tipTitle, Info = tipText, BalloonIconHandle = toastIconHandles[icon], InfoFlags = (int)Shell32.NotifyIconInfoFlags.NiifLargeIcon | (int)Shell32.NotifyIconInfoFlags.NiifUser | (int)Shell32.NotifyIconInfoFlags.NiifNoSound, }; Shell32.ShellNotifyIcon(Shell32.NotifyIconMessage.NimModify, nIconData); }