C# Class Hardcodet.Wpf.TaskbarNotification.TaskbarIcon

Mostrar archivo Open project: Gainedge/BetterExplorer Class Usage Examples

Private Properties

Property Type Description
CloseBalloonCallback void
CreateCustomToolTip void
CreatePopup void
CreateTaskbarIcon void
Dispose void
DoSingleClickAction void
EnsureNotDisposed void
GetDeviceCoordinates Hardcodet.Wpf.TaskbarNotification.Interop.Point
OnBalloonToolTipChanged void
OnExit void
OnMouseEvent void
OnTaskbarCreated void
OnToolTipChange void
RemoveTaskbarIcon void
SetVersion void
ShowBalloonTip void
ShowContextMenu void
ShowTrayPopup void
WriteToolTipSettings void

Public Methods

Method Description
CloseBalloon ( ) : void

Closes the current CustomBalloon, if the property is set.

Dispose ( ) : void

Disposes the object.

This method is not virtual by design. Derived classes should override Dispose(bool).

HideBalloonTip ( ) : void

Hides a balloon ToolTip, if any is displayed.

ResetBalloonCloseTimer ( ) : void

Resets the closing timeout, which effectively keeps a displayed balloon message open until it is either closed programmatically through CloseBalloon or due to a new message being displayed.

ShowBalloonTip ( string title, string message, BalloonIcon symbol ) : void

Displays a balloon tip with the specified title, text, and icon in the taskbar for the specified time period.

ShowBalloonTip ( string title, string message, Icon customIcon ) : void

Displays a balloon tip with the specified title, text, and a custom icon in the taskbar for the specified time period.

ShowCustomBalloon ( UIElement balloon, PopupAnimation animation, int timeout ) : void

Shows a custom control as a tooltip in the tray location.

TaskbarIcon ( ) : System

Inits the taskbar icon and registers a message listener in order to receive events from the taskbar area.

Private Methods

Method Description
CloseBalloonCallback ( object state ) : void

Timer-invoke event which closes the currently open balloon and resets the CustomBalloon dependency property.

CreateCustomToolTip ( ) : void

Creates a ToolTip control that either wraps the currently set TrayToolTip control or the ToolTipText string.
If TrayToolTip itself is already a ToolTip instance, it will be used directly.

We use a ToolTip rather than Popup because there was no way to prevent a popup from causing cyclic open/close commands if it was placed under the mouse. ToolTip internally uses a Popup of its own, but takes advance of Popup's internal UIElement.IsHitTestVisible property which prevents this issue.

CreatePopup ( ) : void

Creates a ToolTip control that either wraps the currently set TrayToolTip control or the ToolTipText string.
If TrayToolTip itself is already a ToolTip instance, it will be used directly.

We use a ToolTip rather than Popup because there was no way to prevent a popup from causing cyclic open/close commands if it was placed under the mouse. ToolTip internally uses a Popup of its own, but takes advance of Popup's internal UIElement.IsHitTestVisible property which prevents this issue.

CreateTaskbarIcon ( ) : void

Creates the taskbar icon. This message is invoked during initialization, if the taskbar is restarted, and whenever the icon is displayed.

Dispose ( bool disposing ) : void

Closes the tray and releases all resources.

Dispose(bool disposing) executes in two distinct scenarios. If disposing equals true, the method has been called directly or indirectly by a user's code. Managed and unmanaged resources can be disposed.

Check the IsDisposed property to determine whether the method has already been called.

DoSingleClickAction ( object state ) : void

Performs a delayed action if the user requested an action based on a single click of the left mouse.
This method is invoked by the singleClickTimer.

EnsureNotDisposed ( ) : void

Checks if the object has been disposed and raises a ObjectDisposedException in case the IsDisposed flag is true.

GetDeviceCoordinates ( Point point ) : Point

Recalculates OS coordinates in order to support WPFs coordinate system if OS scaling (DPIs) is not 100%.

OnBalloonToolTipChanged ( bool visible ) : void

Bubbles events if a balloon ToolTip was displayed or removed.

OnExit ( object sender, EventArgs e ) : void

Disposes the class if the application exits.

OnMouseEvent ( MouseEvent me ) : void

Processes mouse events, which are bubbled through the class' routed events, trigger certain actions (e.g. show a popup), or both.

OnTaskbarCreated ( ) : void

Recreates the taskbar icon if the whole taskbar was recreated (e.g. because Explorer was shut down).

OnToolTipChange ( bool visible ) : void

Displays a custom tooltip, if available. This method is only invoked for Windows Vista and above.

RemoveTaskbarIcon ( ) : void

Closes the taskbar icon if required.

SetVersion ( ) : void

Sets the version flag for the iconData.

ShowBalloonTip ( string title, string message, BalloonFlags flags, IntPtr balloonIconHandle ) : void

Invokes WinApi.Shell_NotifyIcon in order to display a given balloon ToolTip.

ShowContextMenu ( Point cursorPosition ) : void

Displays the ContextMenu if it was set.

ShowTrayPopup ( Point cursorPosition ) : void

Displays the TrayPopup control if it was set.

WriteToolTipSettings ( ) : void

Sets tooltip settings for the class depending on defined dependency properties and OS support.

Method Details

CloseBalloon() public method

Closes the current CustomBalloon, if the property is set.
public CloseBalloon ( ) : void
return void

Dispose() public method

Disposes the object.
This method is not virtual by design. Derived classes should override Dispose(bool).
public Dispose ( ) : void
return void

HideBalloonTip() public method

Hides a balloon ToolTip, if any is displayed.
public HideBalloonTip ( ) : void
return void

ResetBalloonCloseTimer() public method

Resets the closing timeout, which effectively keeps a displayed balloon message open until it is either closed programmatically through CloseBalloon or due to a new message being displayed.
public ResetBalloonCloseTimer ( ) : void
return void

ShowBalloonTip() public method

Displays a balloon tip with the specified title, text, and icon in the taskbar for the specified time period.
public ShowBalloonTip ( string title, string message, BalloonIcon symbol ) : void
title string The title to display on the balloon tip.
message string The text to display on the balloon tip.
symbol BalloonIcon A symbol that indicates the severity.
return void

ShowBalloonTip() public method

Displays a balloon tip with the specified title, text, and a custom icon in the taskbar for the specified time period.
If /// is a null reference.
public ShowBalloonTip ( string title, string message, Icon customIcon ) : void
title string The title to display on the balloon tip.
message string The text to display on the balloon tip.
customIcon Icon A custom icon.
return void

ShowCustomBalloon() public method

Shows a custom control as a tooltip in the tray location.
If /// is a null reference.
public ShowCustomBalloon ( UIElement balloon, PopupAnimation animation, int timeout ) : void
balloon UIElement
animation PopupAnimation An optional animation for the popup.
timeout int The time after which the popup is being closed. /// Submit null in order to keep the balloon open inde ///
return void

TaskbarIcon() public method

Inits the taskbar icon and registers a message listener in order to receive events from the taskbar area.
public TaskbarIcon ( ) : System
return System