private void TrayIcon_NotificationBalloonShown(object sender, NotificationBalloonEventArgs e) { if (Host == null || !Host.Screen.Primary) { return; } BalloonControl.Show(e.Balloon, NotifyIconBorder); e.Handled = true; }
private void TrayIcon_NotificationBalloonShown(object sender, NotificationBalloonEventArgs e) { if (Host != null && Host.Host != null && !Host.Host.GetIsPrimaryDisplay()) { return; } showBalloon(e.Balloon); if (_notifyIcon.IsPinned || (Host != null && Host.UnpinnedItems.Visibility == Visibility.Visible)) { e.Handled = true; } }
private void NotificationArea_NotificationBalloonShown(object sender, NotificationBalloonEventArgs e) { // This is used to promote unpinned icons to show when the tray is collapsed. if (_notificationArea == null) { return; } NotifyIcon notifyIcon = e.Balloon.NotifyIcon; if (_notificationArea.PinnedIcons.Contains(notifyIcon)) { // Do not promote pinned icons (they're already there!) return; } if (PromotedIcons.Contains(notifyIcon)) { // Do not duplicate promoted icons return; } PromotedIcons.Add(notifyIcon); DispatcherTimer unpromoteTimer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(SystemTrayIcon.GetAdjustedBalloonTimeout(e.Balloon) + 400) // Keep it around a few ms for the animation to complete }; unpromoteTimer.Tick += (object timerSender, EventArgs timerE) => { if (PromotedIcons.Contains(notifyIcon)) { PromotedIcons.Remove(notifyIcon); } unpromoteTimer.Stop(); }; unpromoteTimer.Start(); }
private void NotificationArea_NotificationBalloonShown(object sender, NotificationBalloonEventArgs e) { // This is used to promote unpinned icons to show when the tray is collapsed. if (NotificationArea == null) { return; } ManagedShell.WindowsTray.NotifyIcon notifyIcon = e.Balloon.NotifyIcon; if (NotificationArea.PinnedIcons.Contains(notifyIcon)) { // Do not promote pinned icons (they're already there!) return; } if (promotedIcons.Contains(notifyIcon)) { // Do not duplicate promoted icons return; } promotedIcons.Add(notifyIcon); DispatcherTimer unpromoteTimer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(e.Balloon.Timeout + 500) // Keep it around for a few ms for the animation to complete }; unpromoteTimer.Tick += (object sender, EventArgs e) => { if (promotedIcons.Contains(notifyIcon)) { promotedIcons.Remove(notifyIcon); } unpromoteTimer.Stop(); }; unpromoteTimer.Start(); }