diff --git a/Source/NotifyIconWpf.sln b/Source/NotifyIconWpf.sln
index f4acf09..b1e2296 100644
--- a/Source/NotifyIconWpf.sln
+++ b/Source/NotifyIconWpf.sln
@@ -3,10 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NotifyIconWpf", "NotifyIconWpf\NotifyIconWpf.csproj", "{7AC63864-7638-41C4-969C-D3197EF2BED9}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApplication2", "ConsoleApplication2\ConsoleApplication2.csproj", "{A92D287A-6DD2-4D75-9CE5-64BFB990E2D8}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApplication1", "ConsoleApplication1\ConsoleApplication1.csproj", "{10BB9EF0-20F9-460E-96A3-284FF0D1C2E6}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample Project", "Sample Project\Sample Project.csproj", "{71C74F29-F1C2-49C5-969F-C25AC4CDFCCC}"
EndProject
Global
@@ -19,14 +15,6 @@ Global
{7AC63864-7638-41C4-969C-D3197EF2BED9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7AC63864-7638-41C4-969C-D3197EF2BED9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7AC63864-7638-41C4-969C-D3197EF2BED9}.Release|Any CPU.Build.0 = Release|Any CPU
- {A92D287A-6DD2-4D75-9CE5-64BFB990E2D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {A92D287A-6DD2-4D75-9CE5-64BFB990E2D8}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {A92D287A-6DD2-4D75-9CE5-64BFB990E2D8}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {A92D287A-6DD2-4D75-9CE5-64BFB990E2D8}.Release|Any CPU.Build.0 = Release|Any CPU
- {10BB9EF0-20F9-460E-96A3-284FF0D1C2E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {10BB9EF0-20F9-460E-96A3-284FF0D1C2E6}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {10BB9EF0-20F9-460E-96A3-284FF0D1C2E6}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {10BB9EF0-20F9-460E-96A3-284FF0D1C2E6}.Release|Any CPU.Build.0 = Release|Any CPU
{71C74F29-F1C2-49C5-969F-C25AC4CDFCCC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{71C74F29-F1C2-49C5-969F-C25AC4CDFCCC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{71C74F29-F1C2-49C5-969F-C25AC4CDFCCC}.Release|Any CPU.ActiveCfg = Release|Any CPU
diff --git a/Source/NotifyIconWpf.sln.cache b/Source/NotifyIconWpf.sln.cache
index e57874d..90cddce 100644
--- a/Source/NotifyIconWpf.sln.cache
+++ b/Source/NotifyIconWpf.sln.cache
@@ -5,20 +5,10 @@
<_SolutionProjectCacheVersion>3.5
- <_SolutionProjectProjects Include="ConsoleApplication1\ConsoleApplication1.csproj" />
- <_SolutionProjectProjects Include="ConsoleApplication2\ConsoleApplication2.csproj" />
<_SolutionProjectProjects Include="NotifyIconWpf\NotifyIconWpf.csproj" />
<_SolutionProjectProjects Include="Sample Project\Sample Project.csproj" />
-
- Debug
- AnyCPU
-
-
- Debug
- AnyCPU
-
Debug
AnyCPU
@@ -29,14 +19,6 @@
-
- Release
- AnyCPU
-
-
- Release
- AnyCPU
-
Release
AnyCPU
@@ -72,8 +54,6 @@
Debug|AnyCPU
- Debug|AnyCPU
- Debug|AnyCPU
Debug|AnyCPU
@@ -82,8 +62,6 @@
Release|AnyCPU
- Release|AnyCPU
- Release|AnyCPU
Release|AnyCPU
@@ -120,54 +98,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Source/NotifyIconWpf/Interop/NotifyIconData.cs b/Source/NotifyIconWpf/Interop/NotifyIconData.cs
index 9f6f396..78cc5a6 100644
--- a/Source/NotifyIconWpf/Interop/NotifyIconData.cs
+++ b/Source/NotifyIconWpf/Interop/NotifyIconData.cs
@@ -126,7 +126,20 @@ namespace Hardcodet.Wpf.TaskbarNotification.Interop
{
var data = new NotifyIconData();
- data.cbSize = (uint) Marshal.SizeOf(data);
+ if (Environment.OSVersion.Version.Major >= 6)
+ {
+ //use the current size
+ data.cbSize = (uint)Marshal.SizeOf(data);
+ }
+ else
+ {
+ //we need to set another size on xp/2003- otherwise certain
+ //features (e.g. balloon tooltips) don't work.
+ data.cbSize = 504;
+
+ //set to fixed timeout
+ data.VersionOrTimeout = 10;
+ }
data.WindowHandle = handle;
data.TaskbarIconId = 0x0;
diff --git a/Source/NotifyIconWpf/Interop/NotifyIconVersion.cs b/Source/NotifyIconWpf/Interop/NotifyIconVersion.cs
index 8be1618..daf2d60 100644
--- a/Source/NotifyIconWpf/Interop/NotifyIconVersion.cs
+++ b/Source/NotifyIconWpf/Interop/NotifyIconVersion.cs
@@ -12,11 +12,13 @@ namespace Hardcodet.Wpf.TaskbarNotification.Interop
public enum NotifyIconVersion
{
///
- /// Default behavior (legacy Win95).
+ /// Default behavior (legacy Win95). Expects
+ /// a size of 488.
///
Win95 = 0x0,
///
- /// Behavior representing Win2000 an higher.
+ /// Behavior representing Win2000 an higher. Expects
+ /// a size of 504.
///
Win2000 = 0x3,
///
diff --git a/Source/NotifyIconWpf/Interop/TrayLocator.cs b/Source/NotifyIconWpf/Interop/TrayLocator.cs
deleted file mode 100644
index de524a8..0000000
--- a/Source/NotifyIconWpf/Interop/TrayLocator.cs
+++ /dev/null
@@ -1,95 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Runtime.InteropServices;
-
-namespace Hardcodet.Wpf.TaskbarNotification.Interop
-{
- public struct Rect
- {
- public int left;
- public int top;
- public int right;
- public int bottom;
- public override string ToString()
- {
- return "(" + left + ", " + top + ") --> (" + right + ", " + bottom + ")";
- }
- }
-
- public struct TaskbarInfo
- {
- public int cbSize;
- public IntPtr WindowHandle;
- public int uCallbackMessage;
- public TaskbarPosition Position;
- public Rect Rectangle;
- public IntPtr lParam;
- }
-
-
-
- public enum TaskbarPosition
- {
- Left = 0,
- Top,
- Right,
- Bottom
- }
-
-
-
-
- ///
- /// Locates the position of the tray area.
- ///
- public class TrayLocator
- {
- public enum ABMsg
- {
- ABM_NEW = 0,
- ABM_REMOVE = 1,
- ABM_QUERYPOS = 2,
- ABM_SETPOS = 3,
- ABM_GETSTATE = 4,
- ABM_GETTASKBARPOS = 5,
- ABM_ACTIVATE = 6,
- ABM_GETAUTOHIDEBAR = 7,
- ABM_SETAUTOHIDEBAR = 8,
- ABM_WINDOWPOSCHANGED = 9,
- ABM_SETSTATE = 10
- }
-
- public enum ABNotify
- {
- ABN_STATECHANGE = 0,
- ABN_POSCHANGED,
- ABN_FULLSCREENAPP,
- ABN_WINDOWARRANGE
- }
-
- [DllImport("shell32.dll", EntryPoint = "SHAppBarMessage", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
- public static extern int SHAppBarMessage(int dwMessage, ref TaskbarInfo pData);
-
-
- ///
- /// Determines the current location of the taskbar.
- ///
- ///
- public static TaskbarInfo GetTaskbarInformation()
- {
- TaskbarInfo tbInfo = new TaskbarInfo();
- tbInfo.cbSize = Marshal.SizeOf(tbInfo);
-
- //retrieve the bounding rectangle of the Windows taskbar.
- SHAppBarMessage((int)ABMsg.ABM_GETTASKBARPOS, ref tbInfo);
-
- return tbInfo;
- }
-
- }
-}
\ No newline at end of file
diff --git a/Source/NotifyIconWpf/NotifyIconWpf.csproj b/Source/NotifyIconWpf/NotifyIconWpf.csproj
index b78f889..821a357 100644
--- a/Source/NotifyIconWpf/NotifyIconWpf.csproj
+++ b/Source/NotifyIconWpf/NotifyIconWpf.csproj
@@ -24,6 +24,7 @@
DEBUG;TRACE
prompt
4
+ AnyCPU
pdbonly
@@ -32,6 +33,7 @@
TRACE
prompt
4
+ bin\Release\Hardcodet.Wpf.TaskbarNotification.xml
@@ -39,22 +41,14 @@
3.5
-
- 3.5
-
-
- 3.5
-
-
-
+
-
diff --git a/Source/NotifyIconWpf/Properties/AssemblyInfo.cs b/Source/NotifyIconWpf/Properties/AssemblyInfo.cs
index adfde1d..d869e15 100644
--- a/Source/NotifyIconWpf/Properties/AssemblyInfo.cs
+++ b/Source/NotifyIconWpf/Properties/AssemblyInfo.cs
@@ -9,11 +9,11 @@ using System.Windows.Markup;
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("NotifyIconWpf")]
-[assembly: AssemblyDescription("")]
+[assembly: AssemblyDescription("NotifyIcon Implementation for WPF.")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyCompany("hardcodet.net")]
[assembly: AssemblyProduct("NotifyIconWpf")]
-[assembly: AssemblyCopyright("Copyright © Microsoft 2009")]
+[assembly: AssemblyCopyright("Copyright © Philipp Sumi 2009")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
diff --git a/Source/NotifyIconWpf/TaskbarIcon.Declarations.cs b/Source/NotifyIconWpf/TaskbarIcon.Declarations.cs
index cc115d0..bb52d1c 100644
--- a/Source/NotifyIconWpf/TaskbarIcon.Declarations.cs
+++ b/Source/NotifyIconWpf/TaskbarIcon.Declarations.cs
@@ -20,103 +20,116 @@ namespace Hardcodet.Wpf.TaskbarNotification
///
public const string CategoryName = "NotifyIcon";
- ///
- /// A control that was created
- /// in order to display either
- /// or .
- ///
- internal ToolTip CustomToolTip
- {
- get { return IconToolTipResolved; }
- private set { SetIconToolTipResolved(value); }
- }
+
+ //POPUP CONTROLS
+
+ #region TrayPopupResolved
///
- /// A which is either the
- /// control itself or a
- /// that wraps it.
+ /// TrayPopupResolved Read-Only Dependency Property
///
- internal Popup CustomPopup
- {
- get { return IconPopupResolved; }
- private set { SetIconPopupResolved(value); }
- }
-
-
-
- //RESOLVED POPUPS CONTROLS
- #region IconPopupResolved
-
- ///
- /// IconPopupResolved Read-Only Dependency Property
- ///
- private static readonly DependencyPropertyKey IconPopupResolvedPropertyKey
- = DependencyProperty.RegisterReadOnly("IconPopupResolved", typeof(Popup), typeof(TaskbarIcon),
+ private static readonly DependencyPropertyKey TrayPopupResolvedPropertyKey
+ = DependencyProperty.RegisterReadOnly("TrayPopupResolved", typeof(Popup), typeof(TaskbarIcon),
new FrameworkPropertyMetadata(null));
- public static readonly DependencyProperty IconPopupResolvedProperty
- = IconPopupResolvedPropertyKey.DependencyProperty;
+ public static readonly DependencyProperty TrayPopupResolvedProperty
+ = TrayPopupResolvedPropertyKey.DependencyProperty;
///
- /// Gets the IconPopupResolved property. This dependency property
- /// indicates ....
+ /// Gets the TrayPopupResolved property. Returns
+ /// a which is either the
+ /// control itself or a
+ /// control that contains the
+ /// .
///
[Category(CategoryName)]
- public Popup IconPopupResolved
+ public Popup TrayPopupResolved
{
- get { return (Popup)GetValue(IconPopupResolvedProperty); }
+ get { return (Popup)GetValue(TrayPopupResolvedProperty); }
}
///
- /// Provides a secure method for setting the IconPopupResolved property.
+ /// Provides a secure method for setting the TrayPopupResolved property.
/// This dependency property indicates ....
///
/// The new value for the property.
- protected void SetIconPopupResolved(Popup value)
+ protected void SetTrayPopupResolved(Popup value)
{
- SetValue(IconPopupResolvedPropertyKey, value);
+ SetValue(TrayPopupResolvedPropertyKey, value);
}
#endregion
- #region IconToolTipResolved
+ #region TrayToolTipResolved
///
- /// IconToolTipResolved Read-Only Dependency Property
+ /// TrayToolTipResolved Read-Only Dependency Property
///
- private static readonly DependencyPropertyKey IconToolTipResolvedPropertyKey
- = DependencyProperty.RegisterReadOnly("IconToolTipResolved", typeof(ToolTip), typeof(TaskbarIcon),
+ private static readonly DependencyPropertyKey TrayToolTipResolvedPropertyKey
+ = DependencyProperty.RegisterReadOnly("TrayToolTipResolved", typeof(ToolTip), typeof(TaskbarIcon),
new FrameworkPropertyMetadata(null ));
- public static readonly DependencyProperty IconToolTipResolvedProperty
- = IconToolTipResolvedPropertyKey.DependencyProperty;
+ public static readonly DependencyProperty TrayToolTipResolvedProperty
+ = TrayToolTipResolvedPropertyKey.DependencyProperty;
///
- /// Gets the IconToolTipResolved property. This dependency property
- /// indicates ....
+ /// Gets the TrayToolTipResolved property. Returns
+ /// a control that was created
+ /// in order to display either
+ /// or .
///
[Category(CategoryName)]
[Browsable(true)]
[Bindable(true)]
- public ToolTip IconToolTipResolved
+ public ToolTip TrayToolTipResolved
{
- get { return (ToolTip)GetValue(IconToolTipResolvedProperty); }
+ get { return (ToolTip)GetValue(TrayToolTipResolvedProperty); }
}
///
- /// Provides a secure method for setting the IconToolTipResolved property.
- /// This dependency property indicates ....
+ /// Provides a secure method for setting the
+ /// property.
///
/// The new value for the property.
- protected void SetIconToolTipResolved(ToolTip value)
+ protected void SetTrayToolTipResolved(ToolTip value)
{
- SetValue(IconToolTipResolvedPropertyKey, value);
+ SetValue(TrayToolTipResolvedPropertyKey, value);
+ }
+
+ #endregion
+
+ #region CustomBalloon
+
+ ///
+ /// CustomBalloon Read-Only Dependency Property
+ ///
+ private static readonly DependencyPropertyKey CustomBalloonPropertyKey
+ = DependencyProperty.RegisterReadOnly("CustomBalloon", typeof(Popup), typeof(TaskbarIcon),
+ new FrameworkPropertyMetadata(null));
+
+ public static readonly DependencyProperty CustomBalloonProperty
+ = CustomBalloonPropertyKey.DependencyProperty;
+
+ ///
+ /// A custom popup that is being displayed in the tray area in order
+ /// to display messages to the user.
+ ///
+ public Popup CustomBalloon
+ {
+ get { return (Popup)GetValue(CustomBalloonProperty); }
+ }
+
+ ///
+ /// Provides a secure method for setting the CustomBalloon property.
+ ///
+ /// The new value for the property.
+ protected void SetCustomBalloon(Popup value)
+ {
+ SetValue(CustomBalloonPropertyKey, value);
}
#endregion
-
-
//DEPENDENCY PROPERTIES
@@ -253,7 +266,7 @@ namespace Hardcodet.Wpf.TaskbarNotification
private void OnToolTipTextPropertyChanged(DependencyPropertyChangedEventArgs e)
{
//only recreate tooltip if we're not using a custom control
- if (CustomToolTip == null || CustomToolTip.Content is string)
+ if (TrayToolTipResolved == null || TrayToolTipResolved.Content is string)
{
CreateCustomToolTip();
}
@@ -263,21 +276,21 @@ namespace Hardcodet.Wpf.TaskbarNotification
#endregion
- #region TaskbarIconToolTip dependency property
+ #region TrayToolTip dependency property
///
/// A custom UI element that is displayed as a tooltip if the user hovers over the taskbar icon.
/// Works only with Vista and above. Accordingly, you should make sure that
/// the property is set as well.
///
- public static readonly DependencyProperty TaskbarIconToolTipProperty =
- DependencyProperty.Register("TaskbarIconToolTip",
+ public static readonly DependencyProperty TrayToolTipProperty =
+ DependencyProperty.Register("TrayToolTip",
typeof (UIElement),
typeof (TaskbarIcon),
- new FrameworkPropertyMetadata(null, TaskbarIconToolTipPropertyChanged));
+ new FrameworkPropertyMetadata(null, TrayToolTipPropertyChanged));
///
- /// A property wrapper for the
+ /// A property wrapper for the
/// dependency property:
/// A custom UI element that is displayed as a tooltip if the user hovers over the taskbar icon.
/// Works only with Vista and above. Accordingly, you should make sure that
@@ -285,36 +298,36 @@ namespace Hardcodet.Wpf.TaskbarNotification
///
[Category(CategoryName)]
[Description("Custom UI element that is displayed as a tooltip. Only on Vista and above")]
- public UIElement TaskbarIconToolTip
+ public UIElement TrayToolTip
{
- get { return (UIElement) GetValue(TaskbarIconToolTipProperty); }
- set { SetValue(TaskbarIconToolTipProperty, value); }
+ get { return (UIElement) GetValue(TrayToolTipProperty); }
+ set { SetValue(TrayToolTipProperty, value); }
}
///
/// A static callback listener which is being invoked if the
- /// dependency property has
- /// been changed. Invokes the
+ /// dependency property has
+ /// been changed. Invokes the
/// instance method of the changed instance.
///
/// The currently processed owner of the property.
/// Provides information about the updated property.
- private static void TaskbarIconToolTipPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ private static void TrayToolTipPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
TaskbarIcon owner = (TaskbarIcon) d;
- owner.OnTaskbarIconToolTipPropertyChanged(e);
+ owner.OnTrayToolTipPropertyChanged(e);
}
///
- /// Handles changes of the dependency property. As
+ /// Handles changes of the dependency property. As
/// WPF internally uses the dependency property system and bypasses the
- /// property wrapper, updates of the property's value
+ /// property wrapper, updates of the property's value
/// should be handled here.
/// Provides information about the updated property.
- private void OnTaskbarIconToolTipPropertyChanged(DependencyPropertyChangedEventArgs e)
+ private void OnTrayToolTipPropertyChanged(DependencyPropertyChangedEventArgs e)
{
//recreate tooltip control
CreateCustomToolTip();
@@ -327,54 +340,54 @@ namespace Hardcodet.Wpf.TaskbarNotification
#endregion
- #region TaskbarIconPopup dependency property
+ #region TrayPopup dependency property
///
/// A control that is displayed as a popup when the taskbar icon is clicked.
///
- public static readonly DependencyProperty TaskbarIconPopupProperty =
- DependencyProperty.Register("TaskbarIconPopup",
+ public static readonly DependencyProperty TrayPopupProperty =
+ DependencyProperty.Register("TrayPopup",
typeof(UIElement),
typeof (TaskbarIcon),
- new FrameworkPropertyMetadata(null, TaskbarIconPopupPropertyChanged));
+ new FrameworkPropertyMetadata(null, TrayPopupPropertyChanged));
///
- /// A property wrapper for the
+ /// A property wrapper for the
/// dependency property:
/// A control that is displayed as a popup when the taskbar icon is clicked.
///
[Category(CategoryName)]
[Description("Displayed as a Popup if the user clicks on the taskbar icon.")]
- public UIElement TaskbarIconPopup
+ public UIElement TrayPopup
{
- get { return (UIElement)GetValue(TaskbarIconPopupProperty); }
- set { SetValue(TaskbarIconPopupProperty, value); }
+ get { return (UIElement)GetValue(TrayPopupProperty); }
+ set { SetValue(TrayPopupProperty, value); }
}
///
/// A static callback listener which is being invoked if the
- /// dependency property has
- /// been changed. Invokes the
+ /// dependency property has
+ /// been changed. Invokes the
/// instance method of the changed instance.
///
/// The currently processed owner of the property.
/// Provides information about the updated property.
- private static void TaskbarIconPopupPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ private static void TrayPopupPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
TaskbarIcon owner = (TaskbarIcon) d;
- owner.OnTaskbarIconPopupPropertyChanged(e);
+ owner.OnTrayPopupPropertyChanged(e);
}
///
- /// Handles changes of the dependency property. As
+ /// Handles changes of the dependency property. As
/// WPF internally uses the dependency property system and bypasses the
- /// property wrapper, updates of the property's value
+ /// property wrapper, updates of the property's value
/// should be handled here.
/// Provides information about the updated property.
- private void OnTaskbarIconPopupPropertyChanged(DependencyPropertyChangedEventArgs e)
+ private void OnTrayPopupPropertyChanged(DependencyPropertyChangedEventArgs e)
{
//create a pop
CreatePopup();
@@ -442,7 +455,7 @@ namespace Hardcodet.Wpf.TaskbarNotification
#region PopupActivation dependency property
///
- /// Defines what mouse events trigger the .
+ /// Defines what mouse events trigger the .
/// Default is .
///
public static readonly DependencyProperty PopupActivationProperty =
@@ -454,7 +467,7 @@ namespace Hardcodet.Wpf.TaskbarNotification
///
/// A property wrapper for the
/// dependency property:
- /// Defines what mouse events trigger the .
+ /// Defines what mouse events trigger the .
/// Default is .
///
[Category(CategoryName)]
@@ -540,124 +553,124 @@ namespace Hardcodet.Wpf.TaskbarNotification
//EVENTS
- #region TaskbarIconLeftMouseDown
+ #region TrayLeftMouseDown
///
- /// TaskbarIconLeftMouseDown Routed Event
+ /// TrayLeftMouseDown Routed Event
///
- public static readonly RoutedEvent TaskbarIconLeftMouseDownEvent = EventManager.RegisterRoutedEvent("TaskbarIconLeftMouseDown",
+ public static readonly RoutedEvent TrayLeftMouseDownEvent = EventManager.RegisterRoutedEvent("TrayLeftMouseDown",
RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(TaskbarIcon));
///
/// Occurs when the user presses the left mouse button.
///
[Category(CategoryName)]
- public event RoutedEventHandler TaskbarIconLeftMouseDown
+ public event RoutedEventHandler TrayLeftMouseDown
{
- add { AddHandler(TaskbarIconLeftMouseDownEvent, value); }
- remove { RemoveHandler(TaskbarIconLeftMouseDownEvent, value); }
+ add { AddHandler(TrayLeftMouseDownEvent, value); }
+ remove { RemoveHandler(TrayLeftMouseDownEvent, value); }
}
///
- /// A helper method to raise the TaskbarIconLeftMouseDown event.
+ /// A helper method to raise the TrayLeftMouseDown event.
///
- protected RoutedEventArgs RaiseTaskbarIconLeftMouseDownEvent()
+ protected RoutedEventArgs RaiseTrayLeftMouseDownEvent()
{
- return RaiseTaskbarIconLeftMouseDownEvent(this);
+ return RaiseTrayLeftMouseDownEvent(this);
}
///
- /// A static helper method to raise the TaskbarIconLeftMouseDown event on a target element.
+ /// A static helper method to raise the TrayLeftMouseDown event on a target element.
///
/// UIElement or ContentElement on which to raise the event
- internal static RoutedEventArgs RaiseTaskbarIconLeftMouseDownEvent(DependencyObject target)
+ internal static RoutedEventArgs RaiseTrayLeftMouseDownEvent(DependencyObject target)
{
if (target == null) return null;
RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = TaskbarIconLeftMouseDownEvent;
+ args.RoutedEvent = TrayLeftMouseDownEvent;
RoutedEventHelper.RaiseEvent(target, args);
return args;
}
#endregion
- #region TaskbarIconRightMouseDown
+ #region TrayRightMouseDown
///
- /// TaskbarIconRightMouseDown Routed Event
+ /// TrayRightMouseDown Routed Event
///
- public static readonly RoutedEvent TaskbarIconRightMouseDownEvent = EventManager.RegisterRoutedEvent("TaskbarIconRightMouseDown",
+ public static readonly RoutedEvent TrayRightMouseDownEvent = EventManager.RegisterRoutedEvent("TrayRightMouseDown",
RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(TaskbarIcon));
///
/// Occurs when the presses the right mouse button.
///
- public event RoutedEventHandler TaskbarIconRightMouseDown
+ public event RoutedEventHandler TrayRightMouseDown
{
- add { AddHandler(TaskbarIconRightMouseDownEvent, value); }
- remove { RemoveHandler(TaskbarIconRightMouseDownEvent, value); }
+ add { AddHandler(TrayRightMouseDownEvent, value); }
+ remove { RemoveHandler(TrayRightMouseDownEvent, value); }
}
///
- /// A helper method to raise the TaskbarIconRightMouseDown event.
+ /// A helper method to raise the TrayRightMouseDown event.
///
- protected RoutedEventArgs RaiseTaskbarIconRightMouseDownEvent()
+ protected RoutedEventArgs RaiseTrayRightMouseDownEvent()
{
- return RaiseTaskbarIconRightMouseDownEvent(this);
+ return RaiseTrayRightMouseDownEvent(this);
}
///
- /// A static helper method to raise the TaskbarIconRightMouseDown event on a target element.
+ /// A static helper method to raise the TrayRightMouseDown event on a target element.
///
/// UIElement or ContentElement on which to raise the event
- internal static RoutedEventArgs RaiseTaskbarIconRightMouseDownEvent(DependencyObject target)
+ internal static RoutedEventArgs RaiseTrayRightMouseDownEvent(DependencyObject target)
{
if (target == null) return null;
RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = TaskbarIconRightMouseDownEvent;
+ args.RoutedEvent = TrayRightMouseDownEvent;
RoutedEventHelper.RaiseEvent(target, args);
return args;
}
#endregion
- #region TaskbarIconMiddleMouseDown
+ #region TrayMiddleMouseDown
///
- /// TaskbarIconMiddleMouseDown Routed Event
+ /// TrayMiddleMouseDown Routed Event
///
- public static readonly RoutedEvent TaskbarIconMiddleMouseDownEvent = EventManager.RegisterRoutedEvent("TaskbarIconMiddleMouseDown",
+ public static readonly RoutedEvent TrayMiddleMouseDownEvent = EventManager.RegisterRoutedEvent("TrayMiddleMouseDown",
RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(TaskbarIcon));
///
/// Occurs when the user presses the middle mouse button.
///
- public event RoutedEventHandler TaskbarIconMiddleMouseDown
+ public event RoutedEventHandler TrayMiddleMouseDown
{
- add { AddHandler(TaskbarIconMiddleMouseDownEvent, value); }
- remove { RemoveHandler(TaskbarIconMiddleMouseDownEvent, value); }
+ add { AddHandler(TrayMiddleMouseDownEvent, value); }
+ remove { RemoveHandler(TrayMiddleMouseDownEvent, value); }
}
///
- /// A helper method to raise the TaskbarIconMiddleMouseDown event.
+ /// A helper method to raise the TrayMiddleMouseDown event.
///
- protected RoutedEventArgs RaiseTaskbarIconMiddleMouseDownEvent()
+ protected RoutedEventArgs RaiseTrayMiddleMouseDownEvent()
{
- return RaiseTaskbarIconMiddleMouseDownEvent(this);
+ return RaiseTrayMiddleMouseDownEvent(this);
}
///
- /// A static helper method to raise the TaskbarIconMiddleMouseDown event on a target element.
+ /// A static helper method to raise the TrayMiddleMouseDown event on a target element.
///
/// UIElement or ContentElement on which to raise the event
- internal static RoutedEventArgs RaiseTaskbarIconMiddleMouseDownEvent(DependencyObject target)
+ internal static RoutedEventArgs RaiseTrayMiddleMouseDownEvent(DependencyObject target)
{
if (target == null) return null;
RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = TaskbarIconMiddleMouseDownEvent;
+ args.RoutedEvent = TrayMiddleMouseDownEvent;
RoutedEventHelper.RaiseEvent(target, args);
return args;
}
@@ -665,123 +678,123 @@ namespace Hardcodet.Wpf.TaskbarNotification
#endregion
- #region TaskbarIconLeftMouseUp
+ #region TrayLeftMouseUp
///
- /// TaskbarIconLeftMouseUp Routed Event
+ /// TrayLeftMouseUp Routed Event
///
- public static readonly RoutedEvent TaskbarIconLeftMouseUpEvent = EventManager.RegisterRoutedEvent("TaskbarIconLeftMouseUp",
+ public static readonly RoutedEvent TrayLeftMouseUpEvent = EventManager.RegisterRoutedEvent("TrayLeftMouseUp",
RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(TaskbarIcon));
///
/// Occurs when the user releases the left mouse button.
///
- public event RoutedEventHandler TaskbarIconLeftMouseUp
+ public event RoutedEventHandler TrayLeftMouseUp
{
- add { AddHandler(TaskbarIconLeftMouseUpEvent, value); }
- remove { RemoveHandler(TaskbarIconLeftMouseUpEvent, value); }
+ add { AddHandler(TrayLeftMouseUpEvent, value); }
+ remove { RemoveHandler(TrayLeftMouseUpEvent, value); }
}
///
- /// A helper method to raise the TaskbarIconLeftMouseUp event.
+ /// A helper method to raise the TrayLeftMouseUp event.
///
- protected RoutedEventArgs RaiseTaskbarIconLeftMouseUpEvent()
+ protected RoutedEventArgs RaiseTrayLeftMouseUpEvent()
{
- return RaiseTaskbarIconLeftMouseUpEvent(this);
+ return RaiseTrayLeftMouseUpEvent(this);
}
///
- /// A static helper method to raise the TaskbarIconLeftMouseUp event on a target element.
+ /// A static helper method to raise the TrayLeftMouseUp event on a target element.
///
/// UIElement or ContentElement on which to raise the event
- internal static RoutedEventArgs RaiseTaskbarIconLeftMouseUpEvent(DependencyObject target)
+ internal static RoutedEventArgs RaiseTrayLeftMouseUpEvent(DependencyObject target)
{
if (target == null) return null;
RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = TaskbarIconLeftMouseUpEvent;
+ args.RoutedEvent = TrayLeftMouseUpEvent;
RoutedEventHelper.RaiseEvent(target, args);
return args;
}
#endregion
- #region TaskbarIconRightMouseUp
+ #region TrayRightMouseUp
///
- /// TaskbarIconRightMouseUp Routed Event
+ /// TrayRightMouseUp Routed Event
///
- public static readonly RoutedEvent TaskbarIconRightMouseUpEvent = EventManager.RegisterRoutedEvent("TaskbarIconRightMouseUp",
+ public static readonly RoutedEvent TrayRightMouseUpEvent = EventManager.RegisterRoutedEvent("TrayRightMouseUp",
RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(TaskbarIcon));
///
/// Occurs when the user releases the right mouse button.
///
- public event RoutedEventHandler TaskbarIconRightMouseUp
+ public event RoutedEventHandler TrayRightMouseUp
{
- add { AddHandler(TaskbarIconRightMouseUpEvent, value); }
- remove { RemoveHandler(TaskbarIconRightMouseUpEvent, value); }
+ add { AddHandler(TrayRightMouseUpEvent, value); }
+ remove { RemoveHandler(TrayRightMouseUpEvent, value); }
}
///
- /// A helper method to raise the TaskbarIconRightMouseUp event.
+ /// A helper method to raise the TrayRightMouseUp event.
///
- protected RoutedEventArgs RaiseTaskbarIconRightMouseUpEvent()
+ protected RoutedEventArgs RaiseTrayRightMouseUpEvent()
{
- return RaiseTaskbarIconRightMouseUpEvent(this);
+ return RaiseTrayRightMouseUpEvent(this);
}
///
- /// A static helper method to raise the TaskbarIconRightMouseUp event on a target element.
+ /// A static helper method to raise the TrayRightMouseUp event on a target element.
///
/// UIElement or ContentElement on which to raise the event
- internal static RoutedEventArgs RaiseTaskbarIconRightMouseUpEvent(DependencyObject target)
+ internal static RoutedEventArgs RaiseTrayRightMouseUpEvent(DependencyObject target)
{
if (target == null) return null;
RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = TaskbarIconRightMouseUpEvent;
+ args.RoutedEvent = TrayRightMouseUpEvent;
RoutedEventHelper.RaiseEvent(target, args);
return args;
}
#endregion
- #region TaskbarIconMiddleMouseUp
+ #region TrayMiddleMouseUp
///
- /// TaskbarIconMiddleMouseUp Routed Event
+ /// TrayMiddleMouseUp Routed Event
///
- public static readonly RoutedEvent TaskbarIconMiddleMouseUpEvent = EventManager.RegisterRoutedEvent("TaskbarIconMiddleMouseUp",
+ public static readonly RoutedEvent TrayMiddleMouseUpEvent = EventManager.RegisterRoutedEvent("TrayMiddleMouseUp",
RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(TaskbarIcon));
///
/// Occurs when the user releases the middle mouse button.
///
- public event RoutedEventHandler TaskbarIconMiddleMouseUp
+ public event RoutedEventHandler TrayMiddleMouseUp
{
- add { AddHandler(TaskbarIconMiddleMouseUpEvent, value); }
- remove { RemoveHandler(TaskbarIconMiddleMouseUpEvent, value); }
+ add { AddHandler(TrayMiddleMouseUpEvent, value); }
+ remove { RemoveHandler(TrayMiddleMouseUpEvent, value); }
}
///
- /// A helper method to raise the TaskbarIconMiddleMouseUp event.
+ /// A helper method to raise the TrayMiddleMouseUp event.
///
- protected RoutedEventArgs RaiseTaskbarIconMiddleMouseUpEvent()
+ protected RoutedEventArgs RaiseTrayMiddleMouseUpEvent()
{
- return RaiseTaskbarIconMiddleMouseUpEvent(this);
+ return RaiseTrayMiddleMouseUpEvent(this);
}
///
- /// A static helper method to raise the TaskbarIconMiddleMouseUp event on a target element.
+ /// A static helper method to raise the TrayMiddleMouseUp event on a target element.
///
/// UIElement or ContentElement on which to raise the event
- internal static RoutedEventArgs RaiseTaskbarIconMiddleMouseUpEvent(DependencyObject target)
+ internal static RoutedEventArgs RaiseTrayMiddleMouseUpEvent(DependencyObject target)
{
if (target == null) return null;
RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = TaskbarIconMiddleMouseUpEvent;
+ args.RoutedEvent = TrayMiddleMouseUpEvent;
RoutedEventHelper.RaiseEvent(target, args);
return args;
}
@@ -789,82 +802,82 @@ namespace Hardcodet.Wpf.TaskbarNotification
#endregion
- #region TaskbarIconMouseDoubleClick
+ #region TrayMouseDoubleClick
///
- /// TaskbarIconMouseDoubleClick Routed Event
+ /// TrayMouseDoubleClick Routed Event
///
- public static readonly RoutedEvent TaskbarIconMouseDoubleClickEvent = EventManager.RegisterRoutedEvent("TaskbarIconMouseDoubleClick",
+ public static readonly RoutedEvent TrayMouseDoubleClickEvent = EventManager.RegisterRoutedEvent("TrayMouseDoubleClick",
RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(TaskbarIcon));
///
/// Occurs when the user double-clicks the taskbar icon.
///
- public event RoutedEventHandler TaskbarIconMouseDoubleClick
+ public event RoutedEventHandler TrayMouseDoubleClick
{
- add { AddHandler(TaskbarIconMouseDoubleClickEvent, value); }
- remove { RemoveHandler(TaskbarIconMouseDoubleClickEvent, value); }
+ add { AddHandler(TrayMouseDoubleClickEvent, value); }
+ remove { RemoveHandler(TrayMouseDoubleClickEvent, value); }
}
///
- /// A helper method to raise the TaskbarIconMouseDoubleClick event.
+ /// A helper method to raise the TrayMouseDoubleClick event.
///
- protected RoutedEventArgs RaiseTaskbarIconMouseDoubleClickEvent()
+ protected RoutedEventArgs RaiseTrayMouseDoubleClickEvent()
{
- return RaiseTaskbarIconMouseDoubleClickEvent(this);
+ return RaiseTrayMouseDoubleClickEvent(this);
}
///
- /// A static helper method to raise the TaskbarIconMouseDoubleClick event on a target element.
+ /// A static helper method to raise the TrayMouseDoubleClick event on a target element.
///
/// UIElement or ContentElement on which to raise the event
- internal static RoutedEventArgs RaiseTaskbarIconMouseDoubleClickEvent(DependencyObject target)
+ internal static RoutedEventArgs RaiseTrayMouseDoubleClickEvent(DependencyObject target)
{
if (target == null) return null;
RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = TaskbarIconMouseDoubleClickEvent;
+ args.RoutedEvent = TrayMouseDoubleClickEvent;
RoutedEventHelper.RaiseEvent(target, args);
return args;
}
#endregion
- #region TaskbarIconMouseMove
+ #region TrayMouseMove
///
- /// TaskbarIconMouseMove Routed Event
+ /// TrayMouseMove Routed Event
///
- public static readonly RoutedEvent TaskbarIconMouseMoveEvent = EventManager.RegisterRoutedEvent("TaskbarIconMouseMove",
+ public static readonly RoutedEvent TrayMouseMoveEvent = EventManager.RegisterRoutedEvent("TrayMouseMove",
RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(TaskbarIcon));
///
/// Occurs when the user moves the mouse over the taskbar icon.
///
- public event RoutedEventHandler TaskbarIconMouseMove
+ public event RoutedEventHandler TrayMouseMove
{
- add { AddHandler(TaskbarIconMouseMoveEvent, value); }
- remove { RemoveHandler(TaskbarIconMouseMoveEvent, value); }
+ add { AddHandler(TrayMouseMoveEvent, value); }
+ remove { RemoveHandler(TrayMouseMoveEvent, value); }
}
///
- /// A helper method to raise the TaskbarIconMouseMove event.
+ /// A helper method to raise the TrayMouseMove event.
///
- protected RoutedEventArgs RaiseTaskbarIconMouseMoveEvent()
+ protected RoutedEventArgs RaiseTrayMouseMoveEvent()
{
- return RaiseTaskbarIconMouseMoveEvent(this);
+ return RaiseTrayMouseMoveEvent(this);
}
///
- /// A static helper method to raise the TaskbarIconMouseMove event on a target element.
+ /// A static helper method to raise the TrayMouseMove event on a target element.
///
/// UIElement or ContentElement on which to raise the event
- internal static RoutedEventArgs RaiseTaskbarIconMouseMoveEvent(DependencyObject target)
+ internal static RoutedEventArgs RaiseTrayMouseMoveEvent(DependencyObject target)
{
if (target == null) return null;
RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = TaskbarIconMouseMoveEvent;
+ args.RoutedEvent = TrayMouseMoveEvent;
RoutedEventHelper.RaiseEvent(target, args);
return args;
}
@@ -872,123 +885,123 @@ namespace Hardcodet.Wpf.TaskbarNotification
#endregion
- #region TaskbarIconBalloonTipShown
+ #region TrayBalloonTipShown
///
- /// TaskbarIconBalloonTipShown Routed Event
+ /// TrayBalloonTipShown Routed Event
///
- public static readonly RoutedEvent TaskbarIconBalloonTipShownEvent = EventManager.RegisterRoutedEvent("TaskbarIconBalloonTipShown",
+ public static readonly RoutedEvent TrayBalloonTipShownEvent = EventManager.RegisterRoutedEvent("TrayBalloonTipShown",
RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(TaskbarIcon));
///
/// Occurs when a balloon ToolTip is displayed.
///
- public event RoutedEventHandler TaskbarIconBalloonTipShown
+ public event RoutedEventHandler TrayBalloonTipShown
{
- add { AddHandler(TaskbarIconBalloonTipShownEvent, value); }
- remove { RemoveHandler(TaskbarIconBalloonTipShownEvent, value); }
+ add { AddHandler(TrayBalloonTipShownEvent, value); }
+ remove { RemoveHandler(TrayBalloonTipShownEvent, value); }
}
///
- /// A helper method to raise the TaskbarIconBalloonTipShown event.
+ /// A helper method to raise the TrayBalloonTipShown event.
///
- protected RoutedEventArgs RaiseTaskbarIconBalloonTipShownEvent()
+ protected RoutedEventArgs RaiseTrayBalloonTipShownEvent()
{
- return RaiseTaskbarIconBalloonTipShownEvent(this);
+ return RaiseTrayBalloonTipShownEvent(this);
}
///
- /// A static helper method to raise the TaskbarIconBalloonTipShown event on a target element.
+ /// A static helper method to raise the TrayBalloonTipShown event on a target element.
///
/// UIElement or ContentElement on which to raise the event
- internal static RoutedEventArgs RaiseTaskbarIconBalloonTipShownEvent(DependencyObject target)
+ internal static RoutedEventArgs RaiseTrayBalloonTipShownEvent(DependencyObject target)
{
if (target == null) return null;
RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = TaskbarIconBalloonTipShownEvent;
+ args.RoutedEvent = TrayBalloonTipShownEvent;
RoutedEventHelper.RaiseEvent(target, args);
return args;
}
#endregion
- #region TaskbarIconBalloonTipClosed
+ #region TrayBalloonTipClosed
///
- /// TaskbarIconBalloonTipClosed Routed Event
+ /// TrayBalloonTipClosed Routed Event
///
- public static readonly RoutedEvent TaskbarIconBalloonTipClosedEvent = EventManager.RegisterRoutedEvent("TaskbarIconBalloonTipClosed",
+ public static readonly RoutedEvent TrayBalloonTipClosedEvent = EventManager.RegisterRoutedEvent("TrayBalloonTipClosed",
RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(TaskbarIcon));
///
/// Occurs when a balloon ToolTip was closed.
///
- public event RoutedEventHandler TaskbarIconBalloonTipClosed
+ public event RoutedEventHandler TrayBalloonTipClosed
{
- add { AddHandler(TaskbarIconBalloonTipClosedEvent, value); }
- remove { RemoveHandler(TaskbarIconBalloonTipClosedEvent, value); }
+ add { AddHandler(TrayBalloonTipClosedEvent, value); }
+ remove { RemoveHandler(TrayBalloonTipClosedEvent, value); }
}
///
- /// A helper method to raise the TaskbarIconBalloonTipClosed event.
+ /// A helper method to raise the TrayBalloonTipClosed event.
///
- protected RoutedEventArgs RaiseTaskbarIconBalloonTipClosedEvent()
+ protected RoutedEventArgs RaiseTrayBalloonTipClosedEvent()
{
- return RaiseTaskbarIconBalloonTipClosedEvent(this);
+ return RaiseTrayBalloonTipClosedEvent(this);
}
///
- /// A static helper method to raise the TaskbarIconBalloonTipClosed event on a target element.
+ /// A static helper method to raise the TrayBalloonTipClosed event on a target element.
///
/// UIElement or ContentElement on which to raise the event
- internal static RoutedEventArgs RaiseTaskbarIconBalloonTipClosedEvent(DependencyObject target)
+ internal static RoutedEventArgs RaiseTrayBalloonTipClosedEvent(DependencyObject target)
{
if (target == null) return null;
RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = TaskbarIconBalloonTipClosedEvent;
+ args.RoutedEvent = TrayBalloonTipClosedEvent;
RoutedEventHelper.RaiseEvent(target, args);
return args;
}
#endregion
- #region TaskbarIconBalloonTipClicked
+ #region TrayBalloonTipClicked
///
- /// TaskbarIconBalloonTipClicked Routed Event
+ /// TrayBalloonTipClicked Routed Event
///
- public static readonly RoutedEvent TaskbarIconBalloonTipClickedEvent = EventManager.RegisterRoutedEvent("TaskbarIconBalloonTipClicked",
+ public static readonly RoutedEvent TrayBalloonTipClickedEvent = EventManager.RegisterRoutedEvent("TrayBalloonTipClicked",
RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(TaskbarIcon));
///
/// Occurs when the user clicks on a balloon ToolTip.
///
- public event RoutedEventHandler TaskbarIconBalloonTipClicked
+ public event RoutedEventHandler TrayBalloonTipClicked
{
- add { AddHandler(TaskbarIconBalloonTipClickedEvent, value); }
- remove { RemoveHandler(TaskbarIconBalloonTipClickedEvent, value); }
+ add { AddHandler(TrayBalloonTipClickedEvent, value); }
+ remove { RemoveHandler(TrayBalloonTipClickedEvent, value); }
}
///
- /// A helper method to raise the TaskbarIconBalloonTipClicked event.
+ /// A helper method to raise the TrayBalloonTipClicked event.
///
- protected RoutedEventArgs RaiseTaskbarIconBalloonTipClickedEvent()
+ protected RoutedEventArgs RaiseTrayBalloonTipClickedEvent()
{
- return RaiseTaskbarIconBalloonTipClickedEvent(this);
+ return RaiseTrayBalloonTipClickedEvent(this);
}
///
- /// A static helper method to raise the TaskbarIconBalloonTipClicked event on a target element.
+ /// A static helper method to raise the TrayBalloonTipClicked event on a target element.
///
/// UIElement or ContentElement on which to raise the event
- internal static RoutedEventArgs RaiseTaskbarIconBalloonTipClickedEvent(DependencyObject target)
+ internal static RoutedEventArgs RaiseTrayBalloonTipClickedEvent(DependencyObject target)
{
if (target == null) return null;
RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = TaskbarIconBalloonTipClickedEvent;
+ args.RoutedEvent = TrayBalloonTipClickedEvent;
RoutedEventHelper.RaiseEvent(target, args);
return args;
}
@@ -996,156 +1009,156 @@ namespace Hardcodet.Wpf.TaskbarNotification
#endregion
- #region TaskbarIconContextMenuOpen (and PreviewTaskbarIconContextMenuOpen)
+ #region TrayContextMenuOpen (and PreviewTrayContextMenuOpen)
///
- /// TaskbarIconContextMenuOpen Routed Event
+ /// TrayContextMenuOpen Routed Event
///
- public static readonly RoutedEvent TaskbarIconContextMenuOpenEvent = EventManager.RegisterRoutedEvent("TaskbarIconContextMenuOpen",
+ public static readonly RoutedEvent TrayContextMenuOpenEvent = EventManager.RegisterRoutedEvent("TrayContextMenuOpen",
RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(TaskbarIcon));
///
/// Bubbled event that occurs when the context menu of the taskbar icon is being displayed.
///
- public event RoutedEventHandler TaskbarIconContextMenuOpen
+ public event RoutedEventHandler TrayContextMenuOpen
{
- add { AddHandler(TaskbarIconContextMenuOpenEvent, value); }
- remove { RemoveHandler(TaskbarIconContextMenuOpenEvent, value); }
+ add { AddHandler(TrayContextMenuOpenEvent, value); }
+ remove { RemoveHandler(TrayContextMenuOpenEvent, value); }
}
///
- /// A helper method to raise the TaskbarIconContextMenuOpen event.
+ /// A helper method to raise the TrayContextMenuOpen event.
///
- protected RoutedEventArgs RaiseTaskbarIconContextMenuOpenEvent()
+ protected RoutedEventArgs RaiseTrayContextMenuOpenEvent()
{
- return RaiseTaskbarIconContextMenuOpenEvent(this);
+ return RaiseTrayContextMenuOpenEvent(this);
}
///
- /// A static helper method to raise the TaskbarIconContextMenuOpen event on a target element.
+ /// A static helper method to raise the TrayContextMenuOpen event on a target element.
///
/// UIElement or ContentElement on which to raise the event
- internal static RoutedEventArgs RaiseTaskbarIconContextMenuOpenEvent(DependencyObject target)
+ internal static RoutedEventArgs RaiseTrayContextMenuOpenEvent(DependencyObject target)
{
if (target == null) return null;
RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = TaskbarIconContextMenuOpenEvent;
+ args.RoutedEvent = TrayContextMenuOpenEvent;
RoutedEventHelper.RaiseEvent(target, args);
return args;
}
///
- /// PreviewTaskbarIconContextMenuOpen Routed Event
+ /// PreviewTrayContextMenuOpen Routed Event
///
- public static readonly RoutedEvent PreviewTaskbarIconContextMenuOpenEvent = EventManager.RegisterRoutedEvent("PreviewTaskbarIconContextMenuOpen",
+ public static readonly RoutedEvent PreviewTrayContextMenuOpenEvent = EventManager.RegisterRoutedEvent("PreviewTrayContextMenuOpen",
RoutingStrategy.Tunnel, typeof(RoutedEventHandler), typeof(TaskbarIcon));
///
/// Tunneled event that occurs when the context menu of the taskbar icon is being displayed.
///
- public event RoutedEventHandler PreviewTaskbarIconContextMenuOpen
+ public event RoutedEventHandler PreviewTrayContextMenuOpen
{
- add { AddHandler(PreviewTaskbarIconContextMenuOpenEvent, value); }
- remove { RemoveHandler(PreviewTaskbarIconContextMenuOpenEvent, value); }
+ add { AddHandler(PreviewTrayContextMenuOpenEvent, value); }
+ remove { RemoveHandler(PreviewTrayContextMenuOpenEvent, value); }
}
///
- /// A helper method to raise the PreviewTaskbarIconContextMenuOpen event.
+ /// A helper method to raise the PreviewTrayContextMenuOpen event.
///
- protected RoutedEventArgs RaisePreviewTaskbarIconContextMenuOpenEvent()
+ protected RoutedEventArgs RaisePreviewTrayContextMenuOpenEvent()
{
- return RaisePreviewTaskbarIconContextMenuOpenEvent(this);
+ return RaisePreviewTrayContextMenuOpenEvent(this);
}
///
- /// A static helper method to raise the PreviewTaskbarIconContextMenuOpen event on a target element.
+ /// A static helper method to raise the PreviewTrayContextMenuOpen event on a target element.
///
/// UIElement or ContentElement on which to raise the event
- internal static RoutedEventArgs RaisePreviewTaskbarIconContextMenuOpenEvent(DependencyObject target)
+ internal static RoutedEventArgs RaisePreviewTrayContextMenuOpenEvent(DependencyObject target)
{
if (target == null) return null;
RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = PreviewTaskbarIconContextMenuOpenEvent;
+ args.RoutedEvent = PreviewTrayContextMenuOpenEvent;
RoutedEventHelper.RaiseEvent(target, args);
return args;
}
#endregion
- #region TaskbarIconPopupOpen (and PreviewTaskbarIconPopupOpen)
+ #region TrayPopupOpen (and PreviewTrayPopupOpen)
///
- /// TaskbarIconPopupOpen Routed Event
+ /// TrayPopupOpen Routed Event
///
- public static readonly RoutedEvent TaskbarIconPopupOpenEvent = EventManager.RegisterRoutedEvent("TaskbarIconPopupOpen",
+ public static readonly RoutedEvent TrayPopupOpenEvent = EventManager.RegisterRoutedEvent("TrayPopupOpen",
RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(TaskbarIcon));
///
/// Bubbled event that occurs when the custom popup is being opened.
///
- public event RoutedEventHandler TaskbarIconPopupOpen
+ public event RoutedEventHandler TrayPopupOpen
{
- add { AddHandler(TaskbarIconPopupOpenEvent, value); }
- remove { RemoveHandler(TaskbarIconPopupOpenEvent, value); }
+ add { AddHandler(TrayPopupOpenEvent, value); }
+ remove { RemoveHandler(TrayPopupOpenEvent, value); }
}
///
- /// A helper method to raise the TaskbarIconPopupOpen event.
+ /// A helper method to raise the TrayPopupOpen event.
///
- protected RoutedEventArgs RaiseTaskbarIconPopupOpenEvent()
+ protected RoutedEventArgs RaiseTrayPopupOpenEvent()
{
- return RaiseTaskbarIconPopupOpenEvent(this);
+ return RaiseTrayPopupOpenEvent(this);
}
///
- /// A static helper method to raise the TaskbarIconPopupOpen event on a target element.
+ /// A static helper method to raise the TrayPopupOpen event on a target element.
///
/// UIElement or ContentElement on which to raise the event
- internal static RoutedEventArgs RaiseTaskbarIconPopupOpenEvent(DependencyObject target)
+ internal static RoutedEventArgs RaiseTrayPopupOpenEvent(DependencyObject target)
{
if (target == null) return null;
RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = TaskbarIconPopupOpenEvent;
+ args.RoutedEvent = TrayPopupOpenEvent;
RoutedEventHelper.RaiseEvent(target, args);
return args;
}
///
- /// PreviewTaskbarIconPopupOpen Routed Event
+ /// PreviewTrayPopupOpen Routed Event
///
- public static readonly RoutedEvent PreviewTaskbarIconPopupOpenEvent = EventManager.RegisterRoutedEvent("PreviewTaskbarIconPopupOpen",
+ public static readonly RoutedEvent PreviewTrayPopupOpenEvent = EventManager.RegisterRoutedEvent("PreviewTrayPopupOpen",
RoutingStrategy.Tunnel, typeof(RoutedEventHandler), typeof(TaskbarIcon));
///
/// Tunneled event that occurs when the custom popup is being opened.
///
- public event RoutedEventHandler PreviewTaskbarIconPopupOpen
+ public event RoutedEventHandler PreviewTrayPopupOpen
{
- add { AddHandler(PreviewTaskbarIconPopupOpenEvent, value); }
- remove { RemoveHandler(PreviewTaskbarIconPopupOpenEvent, value); }
+ add { AddHandler(PreviewTrayPopupOpenEvent, value); }
+ remove { RemoveHandler(PreviewTrayPopupOpenEvent, value); }
}
///
- /// A helper method to raise the PreviewTaskbarIconPopupOpen event.
+ /// A helper method to raise the PreviewTrayPopupOpen event.
///
- protected RoutedEventArgs RaisePreviewTaskbarIconPopupOpenEvent()
+ protected RoutedEventArgs RaisePreviewTrayPopupOpenEvent()
{
- return RaisePreviewTaskbarIconPopupOpenEvent(this);
+ return RaisePreviewTrayPopupOpenEvent(this);
}
///
- /// A static helper method to raise the PreviewTaskbarIconPopupOpen event on a target element.
+ /// A static helper method to raise the PreviewTrayPopupOpen event on a target element.
///
/// UIElement or ContentElement on which to raise the event
- internal static RoutedEventArgs RaisePreviewTaskbarIconPopupOpenEvent(DependencyObject target)
+ internal static RoutedEventArgs RaisePreviewTrayPopupOpenEvent(DependencyObject target)
{
if (target == null) return null;
RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = PreviewTaskbarIconPopupOpenEvent;
+ args.RoutedEvent = PreviewTrayPopupOpenEvent;
RoutedEventHelper.RaiseEvent(target, args);
return args;
}
@@ -1153,156 +1166,156 @@ namespace Hardcodet.Wpf.TaskbarNotification
#endregion
- #region TaskbarIconToolTipOpen (and PreviewTaskbarIconToolTipOpen)
+ #region TrayToolTipOpen (and PreviewTrayToolTipOpen)
///
- /// TaskbarIconToolTipOpen Routed Event
+ /// TrayToolTipOpen Routed Event
///
- public static readonly RoutedEvent TaskbarIconToolTipOpenEvent = EventManager.RegisterRoutedEvent("TaskbarIconToolTipOpen",
+ public static readonly RoutedEvent TrayToolTipOpenEvent = EventManager.RegisterRoutedEvent("TrayToolTipOpen",
RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(TaskbarIcon));
///
/// Bubbled event that occurs when the custom ToolTip is being displayed.
///
- public event RoutedEventHandler TaskbarIconToolTipOpen
+ public event RoutedEventHandler TrayToolTipOpen
{
- add { AddHandler(TaskbarIconToolTipOpenEvent, value); }
- remove { RemoveHandler(TaskbarIconToolTipOpenEvent, value); }
+ add { AddHandler(TrayToolTipOpenEvent, value); }
+ remove { RemoveHandler(TrayToolTipOpenEvent, value); }
}
///
- /// A helper method to raise the TaskbarIconToolTipOpen event.
+ /// A helper method to raise the TrayToolTipOpen event.
///
- protected RoutedEventArgs RaiseTaskbarIconToolTipOpenEvent()
+ protected RoutedEventArgs RaiseTrayToolTipOpenEvent()
{
- return RaiseTaskbarIconToolTipOpenEvent(this);
+ return RaiseTrayToolTipOpenEvent(this);
}
///
- /// A static helper method to raise the TaskbarIconToolTipOpen event on a target element.
+ /// A static helper method to raise the TrayToolTipOpen event on a target element.
///
/// UIElement or ContentElement on which to raise the event
- internal static RoutedEventArgs RaiseTaskbarIconToolTipOpenEvent(DependencyObject target)
+ internal static RoutedEventArgs RaiseTrayToolTipOpenEvent(DependencyObject target)
{
if (target == null) return null;
RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = TaskbarIconToolTipOpenEvent;
+ args.RoutedEvent = TrayToolTipOpenEvent;
RoutedEventHelper.RaiseEvent(target, args);
return args;
}
///
- /// PreviewTaskbarIconToolTipOpen Routed Event
+ /// PreviewTrayToolTipOpen Routed Event
///
- public static readonly RoutedEvent PreviewTaskbarIconToolTipOpenEvent = EventManager.RegisterRoutedEvent("PreviewTaskbarIconToolTipOpen",
+ public static readonly RoutedEvent PreviewTrayToolTipOpenEvent = EventManager.RegisterRoutedEvent("PreviewTrayToolTipOpen",
RoutingStrategy.Tunnel, typeof(RoutedEventHandler), typeof(TaskbarIcon));
///
/// Tunneled event that occurs when the custom ToolTip is being displayed.
///
- public event RoutedEventHandler PreviewTaskbarIconToolTipOpen
+ public event RoutedEventHandler PreviewTrayToolTipOpen
{
- add { AddHandler(PreviewTaskbarIconToolTipOpenEvent, value); }
- remove { RemoveHandler(PreviewTaskbarIconToolTipOpenEvent, value); }
+ add { AddHandler(PreviewTrayToolTipOpenEvent, value); }
+ remove { RemoveHandler(PreviewTrayToolTipOpenEvent, value); }
}
///
- /// A helper method to raise the PreviewTaskbarIconToolTipOpen event.
+ /// A helper method to raise the PreviewTrayToolTipOpen event.
///
- protected RoutedEventArgs RaisePreviewTaskbarIconToolTipOpenEvent()
+ protected RoutedEventArgs RaisePreviewTrayToolTipOpenEvent()
{
- return RaisePreviewTaskbarIconToolTipOpenEvent(this);
+ return RaisePreviewTrayToolTipOpenEvent(this);
}
///
- /// A static helper method to raise the PreviewTaskbarIconToolTipOpen event on a target element.
+ /// A static helper method to raise the PreviewTrayToolTipOpen event on a target element.
///
/// UIElement or ContentElement on which to raise the event
- internal static RoutedEventArgs RaisePreviewTaskbarIconToolTipOpenEvent(DependencyObject target)
+ internal static RoutedEventArgs RaisePreviewTrayToolTipOpenEvent(DependencyObject target)
{
if (target == null) return null;
RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = PreviewTaskbarIconToolTipOpenEvent;
+ args.RoutedEvent = PreviewTrayToolTipOpenEvent;
RoutedEventHelper.RaiseEvent(target, args);
return args;
}
#endregion
- #region TaskbarIconToolTipClose (and PreviewTaskbarIconToolTipClose)
+ #region TrayToolTipClose (and PreviewTrayToolTipClose)
///
- /// TaskbarIconToolTipClose Routed Event
+ /// TrayToolTipClose Routed Event
///
- public static readonly RoutedEvent TaskbarIconToolTipCloseEvent = EventManager.RegisterRoutedEvent("TaskbarIconToolTipClose",
+ public static readonly RoutedEvent TrayToolTipCloseEvent = EventManager.RegisterRoutedEvent("TrayToolTipClose",
RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(TaskbarIcon));
///
/// Bubbled event that occurs when a custom tooltip is being closed.
///
- public event RoutedEventHandler TaskbarIconToolTipClose
+ public event RoutedEventHandler TrayToolTipClose
{
- add { AddHandler(TaskbarIconToolTipCloseEvent, value); }
- remove { RemoveHandler(TaskbarIconToolTipCloseEvent, value); }
+ add { AddHandler(TrayToolTipCloseEvent, value); }
+ remove { RemoveHandler(TrayToolTipCloseEvent, value); }
}
///
- /// A helper method to raise the TaskbarIconToolTipClose event.
+ /// A helper method to raise the TrayToolTipClose event.
///
- protected RoutedEventArgs RaiseTaskbarIconToolTipCloseEvent()
+ protected RoutedEventArgs RaiseTrayToolTipCloseEvent()
{
- return RaiseTaskbarIconToolTipCloseEvent(this);
+ return RaiseTrayToolTipCloseEvent(this);
}
///
- /// A static helper method to raise the TaskbarIconToolTipClose event on a target element.
+ /// A static helper method to raise the TrayToolTipClose event on a target element.
///
/// UIElement or ContentElement on which to raise the event
- internal static RoutedEventArgs RaiseTaskbarIconToolTipCloseEvent(DependencyObject target)
+ internal static RoutedEventArgs RaiseTrayToolTipCloseEvent(DependencyObject target)
{
if (target == null) return null;
RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = TaskbarIconToolTipCloseEvent;
+ args.RoutedEvent = TrayToolTipCloseEvent;
RoutedEventHelper.RaiseEvent(target, args);
return args;
}
///
- /// PreviewTaskbarIconToolTipClose Routed Event
+ /// PreviewTrayToolTipClose Routed Event
///
- public static readonly RoutedEvent PreviewTaskbarIconToolTipCloseEvent = EventManager.RegisterRoutedEvent("PreviewTaskbarIconToolTipClose",
+ public static readonly RoutedEvent PreviewTrayToolTipCloseEvent = EventManager.RegisterRoutedEvent("PreviewTrayToolTipClose",
RoutingStrategy.Tunnel, typeof(RoutedEventHandler), typeof(TaskbarIcon));
///
/// Tunneled event that occurs when a custom tooltip is being closed.
///
- public event RoutedEventHandler PreviewTaskbarIconToolTipClose
+ public event RoutedEventHandler PreviewTrayToolTipClose
{
- add { AddHandler(PreviewTaskbarIconToolTipCloseEvent, value); }
- remove { RemoveHandler(PreviewTaskbarIconToolTipCloseEvent, value); }
+ add { AddHandler(PreviewTrayToolTipCloseEvent, value); }
+ remove { RemoveHandler(PreviewTrayToolTipCloseEvent, value); }
}
///
- /// A helper method to raise the PreviewTaskbarIconToolTipClose event.
+ /// A helper method to raise the PreviewTrayToolTipClose event.
///
- protected RoutedEventArgs RaisePreviewTaskbarIconToolTipCloseEvent()
+ protected RoutedEventArgs RaisePreviewTrayToolTipCloseEvent()
{
- return RaisePreviewTaskbarIconToolTipCloseEvent(this);
+ return RaisePreviewTrayToolTipCloseEvent(this);
}
///
- /// A static helper method to raise the PreviewTaskbarIconToolTipClose event on a target element.
+ /// A static helper method to raise the PreviewTrayToolTipClose event on a target element.
///
/// UIElement or ContentElement on which to raise the event
- internal static RoutedEventArgs RaisePreviewTaskbarIconToolTipCloseEvent(DependencyObject target)
+ internal static RoutedEventArgs RaisePreviewTrayToolTipCloseEvent(DependencyObject target)
{
if (target == null) return null;
RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = PreviewTaskbarIconToolTipCloseEvent;
+ args.RoutedEvent = PreviewTrayToolTipCloseEvent;
RoutedEventHelper.RaiseEvent(target, args);
return args;
}
@@ -1355,8 +1368,6 @@ namespace Hardcodet.Wpf.TaskbarNotification
}
#endregion
-
-
#region ToolTipOpened
@@ -1445,13 +1456,54 @@ namespace Hardcodet.Wpf.TaskbarNotification
}
#endregion
-
-
-
+
+ #region BalloonShowing
+
+ ///
+ /// BalloonShowing Attached Routed Event
+ ///
+ public static readonly RoutedEvent BalloonShowingEvent = EventManager.RegisterRoutedEvent("BalloonShowing",
+ RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(TaskbarIcon));
+
+ ///
+ /// Adds a handler for the BalloonShowing attached event
+ ///
+ /// UIElement or ContentElement that listens to the event
+ /// Event handler to be added
+ public static void AddBalloonShowingHandler(DependencyObject element, RoutedEventHandler handler)
+ {
+ RoutedEventHelper.AddHandler(element, BalloonShowingEvent, handler);
+ }
+
+ ///
+ /// Removes a handler for the BalloonShowing attached event
+ ///
+ /// UIElement or ContentElement that listens to the event
+ /// Event handler to be removed
+ public static void RemoveBalloonShowingHandler(DependencyObject element, RoutedEventHandler handler)
+ {
+ RoutedEventHelper.RemoveHandler(element, BalloonShowingEvent, handler);
+ }
+
+ ///
+ /// A static helper method to raise the BalloonShowing event on a target element.
+ ///
+ /// UIElement or ContentElement on which to raise the event
+ internal static RoutedEventArgs RaiseBalloonShowingEvent(DependencyObject target)
+ {
+ if (target == null) return null;
+
+ RoutedEventArgs args = new RoutedEventArgs();
+ args.RoutedEvent = BalloonShowingEvent;
+ RoutedEventHelper.RaiseEvent(target, args);
+ return args;
+ }
+
+ #endregion
-
+
//BASE CLASS PROPERTY OVERRIDES
diff --git a/Source/NotifyIconWpf/TaskbarIcon.cs b/Source/NotifyIconWpf/TaskbarIcon.cs
index 4872628..89162bf 100644
--- a/Source/NotifyIconWpf/TaskbarIcon.cs
+++ b/Source/NotifyIconWpf/TaskbarIcon.cs
@@ -8,6 +8,7 @@ using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using Hardcodet.Wpf.TaskbarNotification.Interop;
using Point=Hardcodet.Wpf.TaskbarNotification.Interop.Point;
+using Rect=Hardcodet.Wpf.TaskbarNotification.Interop.Rect;
namespace Hardcodet.Wpf.TaskbarNotification
{
@@ -17,6 +18,8 @@ namespace Hardcodet.Wpf.TaskbarNotification
///
public partial class TaskbarIcon : FrameworkElement, IDisposable
{
+ #region Members
+
///
/// Represents the current icon data.
///
@@ -39,6 +42,11 @@ namespace Hardcodet.Wpf.TaskbarNotification
///
private readonly Timer singleClickTimer;
+ ///
+ /// A timer that is used to close open balloon tooltips.
+ ///
+ private readonly Timer balloonCloseTimer;
+
///
/// Indicates whether the taskbar icon has been created or not.
///
@@ -54,6 +62,29 @@ namespace Hardcodet.Wpf.TaskbarNotification
get { return messageSink.Version == NotifyIconVersion.Vista; }
}
+
+
+ ///
+ /// Checks whether a non-tooltip popup is currently opened.
+ ///
+ private bool IsPopupOpen
+ {
+ get
+ {
+ var popup = TrayPopupResolved;
+ var menu = ContextMenu;
+ var balloon = CustomBalloon;
+
+ return popup != null && popup.IsOpen ||
+ menu != null && menu.IsOpen ||
+ balloon != null && balloon.IsOpen;
+
+ }
+ }
+
+ #endregion
+
+
#region Construction
///
@@ -79,8 +110,9 @@ namespace Hardcodet.Wpf.TaskbarNotification
messageSink.ChangeToolTipStateRequest += OnToolTipChange;
messageSink.BallonToolTipChanged += OnBalloonToolTipChanged;
- //init single click timer
+ //init single click / balloon timers
singleClickTimer = new Timer(DoSingleClickAction);
+ balloonCloseTimer = new Timer(CloseBalloonCallback);
//register listener in order to get notified when the application closes
if (Application.Current != null) Application.Current.Exit += OnExit;
@@ -88,6 +120,112 @@ namespace Hardcodet.Wpf.TaskbarNotification
#endregion
+
+ ///
+ /// Shows a custom control as a tooltip in the tray location.
+ ///
+ ///
+ /// An optional animation for the popup.
+ /// The time after which the popup is being closed.
+ ///
+ /// If
+ /// is a null reference.
+ public void ShowCustomBalloon(UIElement balloon, PopupAnimation animation, int? timeout)
+ {
+ if (balloon == null) throw new ArgumentNullException("balloon");
+ if (timeout.HasValue && timeout < 500)
+ {
+ string msg = "Invalid timeout of {0} milliseconds. Timeout must be at least 500 ms";
+ msg = String.Format(msg, timeout);
+ throw new ArgumentOutOfRangeException("timeout", msg);
+ }
+
+ EnsureNotDisposed();
+
+ //make sure we don't have an open balloon
+ lock (this)
+ {
+ CloseBalloon();
+ }
+
+ //create an invisible popup that hosts the UIElement
+ Popup popup = new Popup();
+ popup.AllowsTransparency = true;
+
+ //don't animate by default - devs can use attached
+ //events or override
+ popup.PopupAnimation = animation;
+
+ Popup.CreateRootPopup(popup, balloon);
+
+ popup.PlacementTarget = this;
+ popup.Placement = PlacementMode.AbsolutePoint;
+ popup.StaysOpen = true;
+
+ Point position = TrayInfo.GetTrayLocation();
+ popup.HorizontalOffset = position.X -1;
+ popup.VerticalOffset = position.Y -1;
+
+ //store reference
+ lock (this)
+ {
+ SetCustomBalloon(popup);
+ }
+
+ //fire attached event
+ RaiseBalloonShowingEvent(balloon);
+
+ //display item
+ popup.IsOpen = true;
+
+ if (timeout.HasValue)
+ {
+ //register timer to close the popup
+ balloonCloseTimer.Change(timeout.Value, Timeout.Infinite);
+ }
+
+ return;
+ }
+
+
+ ///
+ /// Closes the current , if it's set.
+ ///
+ private void CloseBalloon()
+ {
+ if (IsDisposed) return;
+
+ lock (this)
+ {
+ //reset timer in any case
+ balloonCloseTimer.Change(Timeout.Infinite, Timeout.Infinite);
+
+ //reset old popup, if we still have one
+ Popup popup = CustomBalloon;
+ if (popup != null)
+ {
+ //if a balloon message is already displayed, close it immediately
+ popup.IsOpen = false;
+ SetCustomBalloon(null);
+ }
+ }
+ }
+
+
+ ///
+ /// Timer-invoke event which closes the currently open balloon and
+ /// resets the dependency property.
+ ///
+ private void CloseBalloonCallback(object state)
+ {
+ if (IsDisposed) return;
+
+ //switch to UI thread
+ Action action = CloseBalloon;
+ Application.Current.Dispatcher.Invoke(action);
+ }
+
+
#region Process Incoming Mouse Events
///
@@ -104,35 +242,35 @@ namespace Hardcodet.Wpf.TaskbarNotification
switch (me)
{
case MouseEvent.MouseMove:
- RaiseTaskbarIconMouseMoveEvent();
+ RaiseTrayMouseMoveEvent();
//immediately return - there's nothing left to evaluate
return;
case MouseEvent.IconRightMouseDown:
- RaiseTaskbarIconRightMouseDownEvent();
+ RaiseTrayRightMouseDownEvent();
break;
case MouseEvent.IconLeftMouseDown:
- RaiseTaskbarIconLeftMouseDownEvent();
+ RaiseTrayLeftMouseDownEvent();
break;
case MouseEvent.IconRightMouseUp:
- RaiseTaskbarIconRightMouseUpEvent();
+ RaiseTrayRightMouseUpEvent();
break;
case MouseEvent.IconLeftMouseUp:
- RaiseTaskbarIconLeftMouseUpEvent();
+ RaiseTrayLeftMouseUpEvent();
break;
case MouseEvent.IconMiddleMouseDown:
- RaiseTaskbarIconMiddleMouseDownEvent();
+ RaiseTrayMiddleMouseDownEvent();
break;
case MouseEvent.IconMiddleMouseUp:
- RaiseTaskbarIconMiddleMouseUpEvent();
+ RaiseTrayMiddleMouseUpEvent();
break;
case MouseEvent.IconDoubleClick:
//cancel single click timer
singleClickTimer.Change(Timeout.Infinite, Timeout.Infinite);
//bubble event
- RaiseTaskbarIconMouseDoubleClickEvent();
+ RaiseTrayMouseDoubleClickEvent();
break;
case MouseEvent.BalloonToolTipClicked:
- RaiseTaskbarIconBalloonTipClickedEvent();
+ RaiseTrayBalloonTipClickedEvent();
break;
default:
throw new ArgumentOutOfRangeException("me", "Missing handler for mouse event flag: " + me);
@@ -189,47 +327,49 @@ namespace Hardcodet.Wpf.TaskbarNotification
private void OnToolTipChange(bool visible)
{
//if we don't have a tooltip, there's nothing to do here...
- if (CustomToolTip == null) return;
+ if (TrayToolTipResolved == null) return;
if (visible)
{
if (ContextMenu != null && ContextMenu.IsOpen ||
- CustomPopup != null && CustomPopup.IsOpen)
+ TrayPopupResolved != null && TrayPopupResolved.IsOpen)
{
//ignore if we have an open context menu or popup
return;
}
- var args = RaisePreviewTaskbarIconToolTipOpenEvent();
+ var args = RaisePreviewTrayToolTipOpenEvent();
if (args.Handled) return;
- CustomToolTip.IsOpen = true;
+ TrayToolTipResolved.IsOpen = true;
//raise attached event first
- if (TaskbarIconToolTip != null) RaiseToolTipOpenedEvent(TaskbarIconToolTip);
+ if (TrayToolTip != null) RaiseToolTipOpenedEvent(TrayToolTip);
//bubble routed event
- RaiseTaskbarIconToolTipOpenEvent();
+ RaiseTrayToolTipOpenEvent();
}
else
{
- var args = RaisePreviewTaskbarIconToolTipCloseEvent();
+ var args = RaisePreviewTrayToolTipCloseEvent();
if (args.Handled) return;
//raise attached event first
- if (TaskbarIconToolTip != null) RaiseToolTipCloseEvent(TaskbarIconToolTip);
+ if (TrayToolTip != null) RaiseToolTipCloseEvent(TrayToolTip);
- //CustomToolTip.IsOpen = false;
- RaiseTaskbarIconToolTipCloseEvent();
+ TrayToolTipResolved.IsOpen = false;
+
+ //bubble event
+ RaiseTrayToolTipCloseEvent();
}
}
///
/// Creates a control that either
- /// wraps the currently set
+ /// wraps the currently set
/// control or the string.
- /// If itself is already
+ /// If itself is already
/// a instance, it will be used directly.
///
/// We use a rather than
@@ -241,9 +381,9 @@ namespace Hardcodet.Wpf.TaskbarNotification
private void CreateCustomToolTip()
{
//check if the item itself is a tooltip
- ToolTip tt = TaskbarIconToolTip as ToolTip;
+ ToolTip tt = TrayToolTip as ToolTip;
- if (tt == null && TaskbarIconToolTip != null)
+ if (tt == null && TrayToolTip != null)
{
//create an invisible tooltip that hosts the UIElement
tt = new ToolTip();
@@ -262,8 +402,7 @@ namespace Hardcodet.Wpf.TaskbarNotification
//setting the
tt.StaysOpen = true;
-
- tt.Content = TaskbarIconToolTip;
+ tt.Content = TrayToolTip;
}
else if (tt == null && !String.IsNullOrEmpty(ToolTipText))
{
@@ -273,7 +412,7 @@ namespace Hardcodet.Wpf.TaskbarNotification
}
//store a reference to the used tooltip
- CustomToolTip = tt;
+ SetTrayToolTipResolved(tt);
}
@@ -290,7 +429,7 @@ namespace Hardcodet.Wpf.TaskbarNotification
{
//we need to set a tooltip text to get tooltip events from the
//taskbar icon
- if (String.IsNullOrEmpty(iconData.ToolTipText) && CustomToolTip != null)
+ if (String.IsNullOrEmpty(iconData.ToolTipText) && TrayToolTipResolved != null)
{
//if we have not tooltip text but a custom tooltip, we
//need to set a dummy value (we're displaying the ToolTip control, not the string)
@@ -308,9 +447,9 @@ namespace Hardcodet.Wpf.TaskbarNotification
///
/// Creates a control that either
- /// wraps the currently set
+ /// wraps the currently set
/// control or the string.
- /// If itself is already
+ /// If itself is already
/// a instance, it will be used directly.
///
/// We use a rather than
@@ -322,24 +461,27 @@ namespace Hardcodet.Wpf.TaskbarNotification
private void CreatePopup()
{
//no popup is available
- if (TaskbarIconPopup == null) return;
+ if (TrayPopup == null) return;
//check if the item itself is a popup
- Popup popup = TaskbarIconPopup as Popup;
+ Popup popup = TrayPopup as Popup;
if (popup == null)
{
//create an invisible popup that hosts the UIElement
popup = new Popup();
popup.AllowsTransparency = true;
- popup.PopupAnimation = PopupAnimation.Fade;
+
+ //don't animate by default - devs can use attached
+ //events or override
+ popup.PopupAnimation = PopupAnimation.None;
//the tooltip (and implicitly its context) explicitly gets
//the DataContext of this instance. If there is no DataContext,
//the TaskbarIcon assigns itself
popup.DataContext = DataContext ?? this;
- Popup.CreateRootPopup(popup, TaskbarIconPopup);
+ Popup.CreateRootPopup(popup, TrayPopup);
popup.PlacementTarget = this;
popup.Placement = PlacementMode.AbsolutePoint;
@@ -347,11 +489,12 @@ namespace Hardcodet.Wpf.TaskbarNotification
}
//store a reference to the used tooltip
- CustomPopup = popup;
+ SetTrayPopupResolved(popup);
}
+
///
- /// Displays the control if
+ /// Displays the control if
/// it was set.
///
private void ShowTrayPopup(Point cursorPosition)
@@ -360,18 +503,18 @@ namespace Hardcodet.Wpf.TaskbarNotification
//raise preview event no matter whether popup is currently set
//or not (enables client to set it on demand)
- var args = RaisePreviewTaskbarIconPopupOpenEvent();
+ var args = RaisePreviewTrayPopupOpenEvent();
if (args.Handled) return;
- if (TaskbarIconPopup != null)
+ if (TrayPopup != null)
{
//use absolute position, but place the popup centered above the icon
- CustomPopup.Placement = PlacementMode.AbsolutePoint;
- CustomPopup.HorizontalOffset = cursorPosition.X; //+ TaskbarIconPopup.ActualWidth/2;
- CustomPopup.VerticalOffset = cursorPosition.Y;
+ TrayPopupResolved.Placement = PlacementMode.AbsolutePoint;
+ TrayPopupResolved.HorizontalOffset = cursorPosition.X;
+ TrayPopupResolved.VerticalOffset = cursorPosition.Y;
//open popup
- CustomPopup.IsOpen = true;
+ TrayPopupResolved.IsOpen = true;
//activate the message window to track deactivation - otherwise, the context menu
//does not close if the user clicks somewhere else
@@ -379,10 +522,10 @@ namespace Hardcodet.Wpf.TaskbarNotification
//raise attached event - item should never be null unless developers
//changed the CustomPopup directly...
- if (TaskbarIconPopup != null) RaisePopupOpenedEvent(TaskbarIconPopup);
+ if (TrayPopup != null) RaisePopupOpenedEvent(TrayPopup);
//bubble routed event
- RaiseTaskbarIconPopupOpenEvent();
+ RaiseTrayPopupOpenEvent();
}
}
@@ -400,7 +543,7 @@ namespace Hardcodet.Wpf.TaskbarNotification
//raise preview event no matter whether context menu is currently set
//or not (enables client to set it on demand)
- var args = RaisePreviewTaskbarIconContextMenuOpenEvent();
+ var args = RaisePreviewTrayContextMenuOpenEvent();
if (args.Handled) return;
if (ContextMenu != null)
@@ -416,7 +559,7 @@ namespace Hardcodet.Wpf.TaskbarNotification
WinApi.SetForegroundWindow(messageSink.MessageWindowHandle);
//bubble event
- RaiseTaskbarIconContextMenuOpenEvent();
+ RaiseTrayContextMenuOpenEvent();
}
}
@@ -434,11 +577,11 @@ namespace Hardcodet.Wpf.TaskbarNotification
{
if (visible)
{
- RaiseTaskbarIconBalloonTipShownEvent();
+ RaiseTrayBalloonTipShownEvent();
}
else
{
- RaiseTaskbarIconBalloonTipClosedEvent();
+ RaiseTrayBalloonTipClosedEvent();
}
}
@@ -491,12 +634,12 @@ namespace Hardcodet.Wpf.TaskbarNotification
{
EnsureNotDisposed();
- iconData.BalloonText = message;
- iconData.BalloonTitle = title;
+ iconData.BalloonText = message ?? String.Empty;
+ iconData.BalloonTitle = title ?? String.Empty;
iconData.BalloonFlags = flags;
iconData.CustomBalloonIconHandle = balloonIconHandle;
- Util.WriteIconData(ref iconData, NotifyCommand.Modify, IconDataMembers.Info);
+ Util.WriteIconData(ref iconData, NotifyCommand.Modify, IconDataMembers.Info | IconDataMembers.Icon);
}
@@ -720,8 +863,9 @@ namespace Hardcodet.Wpf.TaskbarNotification
//deregister application event listener
Application.Current.Exit -= OnExit;
- //stop timer
+ //stop timers
singleClickTimer.Dispose();
+ balloonCloseTimer.Dispose();
//dispose message sink
messageSink.Dispose();
diff --git a/Source/Sample Project/FancyPopup.xaml b/Source/Sample Project/FancyPopup.xaml
index c6cddc8..44c32ce 100644
--- a/Source/Sample Project/FancyPopup.xaml
+++ b/Source/Sample Project/FancyPopup.xaml
@@ -63,11 +63,11 @@
public partial class Window1 : Window
{
-
-
public Window1()
{
InitializeComponent();
}
- private void OnClick(object sender, RoutedEventArgs e)
+
+ ///
+ /// Displays a balloon tip.
+ ///
+ private void showBalloonTip_Click(object sender, RoutedEventArgs e)
{
- if (tb.Visibility == System.Windows.Visibility.Visible)
+ string title = txtBalloonTitle.Text;
+ string message = txtBalloonText.Text;
+
+ if (rbCustomIcon.IsChecked == true)
{
- tb.Visibility = System.Windows.Visibility.Collapsed;
+ //just display the icon on the tray
+ var icon = tb.Icon;
+ tb.ShowBalloonTip(title, message, icon);
}
else
{
- tb.Visibility = Visibility.Visible;
+ BalloonIcon bi = rbInfo.IsChecked == true ? BalloonIcon.Info : BalloonIcon.Error;
+ tb.ShowBalloonTip(title, message, bi);
}
}
+
+ private void hideBalloonTip_Click(object sender, RoutedEventArgs e)
+ {
+ tb.HideBalloonTip();
+ }
+
+
+ ///
+ /// Resets the tooltip.
+ ///
+ private void removeToolTip_Click(object sender, RoutedEventArgs e)
+ {
+ tb.TrayToolTip = null;
+ }
+
+
+
+ private void showCustomBalloon_Click(object sender, RoutedEventArgs e)
+ {
+ FancyBalloon balloon = new FancyBalloon();
+ balloon.BalloonText = customBalloonTitle.Text;
+ //show and close after 2.5 seconds
+ tb.ShowCustomBalloon(balloon, PopupAnimation.Slide, 5000);
+ }
}
-}
+}
\ No newline at end of file