diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..1ff0c42
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,63 @@
+###############################################################################
+# Set default behavior to automatically normalize line endings.
+###############################################################################
+* text=auto
+
+###############################################################################
+# Set default behavior for command prompt diff.
+#
+# This is need for earlier builds of msysgit that does not have it on by
+# default for csharp files.
+# Note: This is only used by command line
+###############################################################################
+#*.cs diff=csharp
+
+###############################################################################
+# Set the merge driver for project and solution files
+#
+# Merging from the command prompt will add diff markers to the files if there
+# are conflicts (Merging from VS is not affected by the settings below, in VS
+# the diff markers are never inserted). Diff markers may cause the following
+# file extensions to fail to load in VS. An alternative would be to treat
+# these files as binary and thus will always conflict and require user
+# intervention with every merge. To do so, just uncomment the entries below
+###############################################################################
+#*.sln merge=binary
+#*.csproj merge=binary
+#*.vbproj merge=binary
+#*.vcxproj merge=binary
+#*.vcproj merge=binary
+#*.dbproj merge=binary
+#*.fsproj merge=binary
+#*.lsproj merge=binary
+#*.wixproj merge=binary
+#*.modelproj merge=binary
+#*.sqlproj merge=binary
+#*.wwaproj merge=binary
+
+###############################################################################
+# behavior for image files
+#
+# image files are treated as binary by default.
+###############################################################################
+#*.jpg binary
+#*.png binary
+#*.gif binary
+
+###############################################################################
+# diff behavior for common document formats
+#
+# Convert binary document formats to text before diffing them. This feature
+# is only available from the command line. Turn it on by uncommenting the
+# entries below.
+###############################################################################
+#*.doc diff=astextplain
+#*.DOC diff=astextplain
+#*.docx diff=astextplain
+#*.DOCX diff=astextplain
+#*.dot diff=astextplain
+#*.DOT diff=astextplain
+#*.pdf diff=astextplain
+#*.PDF diff=astextplain
+#*.rtf diff=astextplain
+#*.RTF diff=astextplain
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..1bc915c
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,156 @@
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+
+# User-specific files
+*.suo
+*.user
+*.sln.docstates
+
+# Build results
+
+[Dd]ebug/
+[Rr]elease/
+x64/
+build/
+[Bb]in/
+[Oo]bj/
+
+# Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets
+!packages/*/build/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+*_i.c
+*_p.c
+*.ilk
+*.meta
+*.obj
+*.pch
+*.pdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*.log
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.log
+*.scc
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opensdf
+*.sdf
+*.cachefile
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# NCrunch
+*.ncrunch*
+.*crunch*.local.xml
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.Publish.xml
+
+# NuGet Packages Directory
+## TODO: If you have NuGet Package Restore enabled, uncomment the next line
+#packages/
+
+# Windows Azure Build Output
+csx
+*.build.csdef
+
+# Windows Store app package directory
+AppPackages/
+
+# Others
+sql/
+*.Cache
+ClientBin/
+[Ss]tyle[Cc]op.*
+~$*
+*~
+*.dbmdl
+*.[Pp]ublish.xml
+*.pfx
+*.publishsettings
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file to a newer
+# Visual Studio version. Backup files are not needed, because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+
+# SQL Server files
+App_Data/*.mdf
+App_Data/*.ldf
+
+
+#LightSwitch generated files
+GeneratedArtifacts/
+_Pvt_Extensions/
+ModelManifest.xml
+
+# =========================
+# Windows detritus
+# =========================
+
+# Windows image file caches
+Thumbs.db
+ehthumbs.db
+
+# Folder config file
+Desktop.ini
+
+# Recycle Bin used on file shares
+$RECYCLE.BIN/
+
+# Mac desktop service store files
+.DS_Store
diff --git a/Hardcodet.NotifyIcon.Wpf/NuGet/Hardcodet.NotifyIcon.Wpf.1.0.5.nuspec b/Hardcodet.NotifyIcon.Wpf/NuGet/Hardcodet.NotifyIcon.Wpf.1.0.5.nuspec
index 195247c..b05302f 100644
--- a/Hardcodet.NotifyIcon.Wpf/NuGet/Hardcodet.NotifyIcon.Wpf.1.0.5.nuspec
+++ b/Hardcodet.NotifyIcon.Wpf/NuGet/Hardcodet.NotifyIcon.Wpf.1.0.5.nuspec
@@ -1,42 +1,42 @@
-
-
-
- Hardcodet.NotifyIcon.Wpf
- 1.0.5
- Hardcodet WPF NotifyIcon
- Philipp Sumi
- Philipp Sumi
- http://www.codeproject.com/info/cpol10.aspx
- http://www.hardcodet.net/projects/wpf-notifyicon
- false
+
+
+
+ Hardcodet.NotifyIcon.Wpf
+ 1.0.5
+ Hardcodet WPF NotifyIcon
+ Philipp Sumi
+ Philipp Sumi
+ http://www.codeproject.com/info/cpol10.aspx
+ http://www.hardcodet.net/projects/wpf-notifyicon
+ false
This is an implementation of a NotifyIcon (aka system tray icon or taskbar icon) for the WPF platform. It does not just rely on the Windows Forms NotifyIcon component, but is a purely independent control which leverages several features of the WPF framework in order to display rich tooltips, popups, context menus, and balloon messages. It can be used directly in code or embedded in any XAML file.
-Source code and extensive sample application available at http://www.hardcodet.net/projects/wpf-notifyicon
- NotifyIcon (aka system tray icon or taskbar icon) for the WPF platform.
- Mostly bug fixes and full x64 / Win 8 support. Contains source and binaries for .NET 3.5 - 4.51.
- Copyright (c) 2013 Philipp Sumi
-
- NotifyIcon WPF Tray Notify ToolTip Popup Balloon Toast
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+Source code and extensive sample application available at http://www.hardcodet.net/projects/wpf-notifyicon
+ NotifyIcon (aka system tray icon or taskbar icon) for the WPF platform.
+ Mostly bug fixes and full x64 / Win 8 support. Contains source and binaries for .NET 3.5 - 4.51.
+ Copyright (c) 2013 Philipp Sumi
+
+ NotifyIcon WPF Tray Notify ToolTip Popup Balloon Toast
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/NuGet/Legacy Switch/Hardcodet.Wpf.TaskbarNotification.1.0.5.nuspec b/Hardcodet.NotifyIcon.Wpf/NuGet/Legacy Switch/Hardcodet.Wpf.TaskbarNotification.1.0.5.nuspec
index aae06f7..046317c 100644
--- a/Hardcodet.NotifyIcon.Wpf/NuGet/Legacy Switch/Hardcodet.Wpf.TaskbarNotification.1.0.5.nuspec
+++ b/Hardcodet.NotifyIcon.Wpf/NuGet/Legacy Switch/Hardcodet.Wpf.TaskbarNotification.1.0.5.nuspec
@@ -1,31 +1,31 @@
-
-
-
- Hardcodet.Wpf.TaskbarNotification
- 1.0.5
- Hardcodet.Wpf.TaskbarNotification
- Philipp Sumi
- Philipp Sumi
- http://www.codeproject.com/info/cpol10.aspx
- http://www.hardcodet.net/projects/wpf-notifyicon
- false
+
+
+
+ Hardcodet.Wpf.TaskbarNotification
+ 1.0.5
+ Hardcodet.Wpf.TaskbarNotification
+ Philipp Sumi
+ Philipp Sumi
+ http://www.codeproject.com/info/cpol10.aspx
+ http://www.hardcodet.net/projects/wpf-notifyicon
+ false
THIS PACKAGE IS OBSOLETE.
Please switch to the officially maintained NuGet package: Hardcodet.NotifyIcon.WPF
This is an implementation of a NotifyIcon (aka system tray icon or taskbar icon) for the WPF platform. It does not just rely on the Windows Forms NotifyIcon component, but is a purely independent control which leverages several features of the WPF framework in order to display rich tooltips, popups, context menus, and balloon messages. It can be used directly in code or embedded in any XAML file.
-Source code and extensive sample application available at http://www.hardcodet.net/projects/wpf-notifyicon
- This package is obsolete. Please switch to the maintained NuGet package: Hardcodet.NotifyIcon.WPF
- Mostly bug fixes and full x64 / Win 8 support. Contains source and binaries for .NET 3.5 - 4.51.
- Copyright (c) 2013 Philipp Sumi
-
- NotifyIcon WPF Tray Notify ToolTip Popup Balloon Toast
-
-
-
-
-
-
-
+Source code and extensive sample application available at http://www.hardcodet.net/projects/wpf-notifyicon
+ This package is obsolete. Please switch to the maintained NuGet package: Hardcodet.NotifyIcon.WPF
+ Mostly bug fixes and full x64 / Win 8 support. Contains source and binaries for .NET 3.5 - 4.51.
+ Copyright (c) 2013 Philipp Sumi
+
+ NotifyIcon WPF Tray Notify ToolTip Popup Balloon Toast
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/NuGet/Legacy Switch/readme.from.legacy.package.txt b/Hardcodet.NotifyIcon.Wpf/NuGet/Legacy Switch/readme.from.legacy.package.txt
index faf6894..ac394ba 100644
--- a/Hardcodet.NotifyIcon.Wpf/NuGet/Legacy Switch/readme.from.legacy.package.txt
+++ b/Hardcodet.NotifyIcon.Wpf/NuGet/Legacy Switch/readme.from.legacy.package.txt
@@ -1,9 +1,9 @@
-Hardcodet NotifyIcon for WPF
-****************************
-
-THIS PACKAGE IS OBSOLETE.
-
-This package has a dependency to the official package in order to keep things working for you, but consider switching to the official NuGet package: Hardcodet.NotifyIcon.Wpf
-
-For direct NuGet links, source code or samples, please visit the project page:
+Hardcodet NotifyIcon for WPF
+****************************
+
+THIS PACKAGE IS OBSOLETE.
+
+This package has a dependency to the official package in order to keep things working for you, but consider switching to the official NuGet package: Hardcodet.NotifyIcon.Wpf
+
+For direct NuGet links, source code or samples, please visit the project page:
http://www.hardcodet.net/projects/wpf-notifyicon
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/NuGet/readme.1.0.5.txt b/Hardcodet.NotifyIcon.Wpf/NuGet/readme.1.0.5.txt
index 832c9fa..44773fc 100644
--- a/Hardcodet.NotifyIcon.Wpf/NuGet/readme.1.0.5.txt
+++ b/Hardcodet.NotifyIcon.Wpf/NuGet/readme.1.0.5.txt
@@ -1,10 +1,10 @@
-Hardcodet NotifyIcon for WPF 1.0.5
-**********************************
-
-This is an implementation of a NotifyIcon (aka system tray icon or taskbar icon) for the WPF platform. It does not just rely on the Windows Forms NotifyIcon component, but is a purely independent control which leverages several features of the WPF framework in order to display rich tooltips, popups, context menus, and balloon messages. It can be used directly in code or embedded in any XAML file.
-
-This package contains only binaries. For source code and samples, please visit the project page:
-http://www.hardcodet.net/projects/wpf-notifyicon
-
-
-
+Hardcodet NotifyIcon for WPF 1.0.5
+**********************************
+
+This is an implementation of a NotifyIcon (aka system tray icon or taskbar icon) for the WPF platform. It does not just rely on the Windows Forms NotifyIcon component, but is a purely independent control which leverages several features of the WPF framework in order to display rich tooltips, popups, context menus, and balloon messages. It can be used directly in code or embedded in any XAML file.
+
+This package contains only binaries. For source code and samples, please visit the project page:
+http://www.hardcodet.net/projects/wpf-notifyicon
+
+
+
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/BuildTargets.cmd b/Hardcodet.NotifyIcon.Wpf/Source/BuildTargets.cmd
index bada9ef..5640701 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/BuildTargets.cmd
+++ b/Hardcodet.NotifyIcon.Wpf/Source/BuildTargets.cmd
@@ -1,9 +1,9 @@
-"C:\Program Files (x86)\MSBuild\12.0\Bin\msbuild.exe" NotifyIconWpf\NotifyIconWpf.csproj /p:Configuration=Release;TargetFrameworkVersion=v3.5;TargetFrameworkProfile="";OutputPath=..\..\Binaries\net35 /t:Rebuild
-"C:\Program Files (x86)\MSBuild\12.0\Bin\msbuild.exe" NotifyIconWpf\NotifyIconWpf.csproj /p:Configuration=Release;TargetFrameworkVersion=v3.5;TargetFrameworkProfile="Client";OutputPath=..\..\Binaries\net35-client /t:Rebuild
-
-"C:\Program Files (x86)\MSBuild\12.0\Bin\msbuild.exe" NotifyIconWpf\NotifyIconWpf.csproj /p:Configuration=Release;TargetFrameworkVersion=v4.0;TargetFrameworkProfile="";OutputPath=..\..\Binaries\net40 /t:Rebuild
-"C:\Program Files (x86)\MSBuild\12.0\Bin\msbuild.exe" NotifyIconWpf\NotifyIconWpf.csproj /p:Configuration=Release;TargetFrameworkVersion=v4.0;TargetFrameworkProfile="Client";OutputPath=..\..\Binaries\net40-client /t:Rebuild
-
-"C:\Program Files (x86)\MSBuild\12.0\Bin\msbuild.exe" NotifyIconWpf\NotifyIconWpf.csproj /p:Configuration=Release;TargetFrameworkVersion=v4.5;TargetFrameworkProfile="";OutputPath=..\..\Binaries\net45 /t:Rebuild
-
-"C:\Program Files (x86)\MSBuild\12.0\Bin\msbuild.exe" NotifyIconWpf\NotifyIconWpf.csproj /p:Configuration=Release;TargetFrameworkVersion=v4.5.1;TargetFrameworkProfile="";OutputPath=..\..\Binaries\net451 /t:Rebuild
+"C:\Program Files (x86)\MSBuild\12.0\Bin\msbuild.exe" NotifyIconWpf\NotifyIconWpf.csproj /p:Configuration=Release;TargetFrameworkVersion=v3.5;TargetFrameworkProfile="";OutputPath=..\..\Binaries\net35 /t:Rebuild
+"C:\Program Files (x86)\MSBuild\12.0\Bin\msbuild.exe" NotifyIconWpf\NotifyIconWpf.csproj /p:Configuration=Release;TargetFrameworkVersion=v3.5;TargetFrameworkProfile="Client";OutputPath=..\..\Binaries\net35-client /t:Rebuild
+
+"C:\Program Files (x86)\MSBuild\12.0\Bin\msbuild.exe" NotifyIconWpf\NotifyIconWpf.csproj /p:Configuration=Release;TargetFrameworkVersion=v4.0;TargetFrameworkProfile="";OutputPath=..\..\Binaries\net40 /t:Rebuild
+"C:\Program Files (x86)\MSBuild\12.0\Bin\msbuild.exe" NotifyIconWpf\NotifyIconWpf.csproj /p:Configuration=Release;TargetFrameworkVersion=v4.0;TargetFrameworkProfile="Client";OutputPath=..\..\Binaries\net40-client /t:Rebuild
+
+"C:\Program Files (x86)\MSBuild\12.0\Bin\msbuild.exe" NotifyIconWpf\NotifyIconWpf.csproj /p:Configuration=Release;TargetFrameworkVersion=v4.5;TargetFrameworkProfile="";OutputPath=..\..\Binaries\net45 /t:Rebuild
+
+"C:\Program Files (x86)\MSBuild\12.0\Bin\msbuild.exe" NotifyIconWpf\NotifyIconWpf.csproj /p:Configuration=Release;TargetFrameworkVersion=v4.5.1;TargetFrameworkProfile="";OutputPath=..\..\Binaries\net451 /t:Rebuild
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Changelog.txt b/Hardcodet.NotifyIcon.Wpf/Source/Changelog.txt
index 1869505..d38878c 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Changelog.txt
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Changelog.txt
@@ -1,77 +1,77 @@
-hardcodet.net NotifyIcon for WPF - Changelog
-Copyright (c) 2009-2013 Philipp Sumi
-Contact and Information: http://www.hardcodet.net
-
-
-1.0.5 (2013.11.20)
-*****
-
-FIX Support for x64 applications targeting .NET 4 x64 or higher (big thanks to Mark Junker for submitting a patch!)
-CHG Component does no longer throw an exception is no Explorer shell is present,
- but waits for it to be created.
-CHG NotifyIcon is not only removed on user-initiated disposal, but also garbage collection.
-CHG The attached ParentTaskbarIconProperty is now derived, so data binding to the attached DP
- becomes much simpler
- (e.g. )
-CHG WinAPI interop now uses Unicode in order to prevent issues with Asian languages. Thanks to JO Hyeong-Ryeol for posting an easy fix!
-FIX Context menues receiving keyboard events, which allows for TextBoxes in context menus.
-FIX Coordinates calculated properly on operating systems with non-standard DPIs. Thanks Rusi Filipov for bug reporting and testing.
-FIX Data-bound ToolTipText may have caused ToolTips to remain open in case of property changes.
-
-
-----------------------------------------------------------------------------
-
-1.0.4 (2009.09.21)
-*****
-
-FIX If a popup is opened, its window handle is now being set as the foreground.
- This fixes an issue with certain controls being disabled on popups.
- (thanks Andrew Smith for pointing me in the right direction!).
-FIX Changed dispatcher access in order to work in WinForms scenarios, too.
-FIX Corrected typo in WindowMessageSink.BalloonToolTipChanged event (thanks Mertsch).
- Used internally (although event is public), so this shouldn't be a breaking change.
-FIX Dispose only deregisters OnExit event listenter if there is actually an
- application (not the case in WinForms environments).
-
-
-----------------------------------------------------------------------------
-
-1.0.3 (2009.07.02)
-*****
-FIX Commands did not work with RoutedCommands which require an explicit target
- (thanks Rodolfo Grave).
-ADD Added command target properties for both left and double click commands.
- Allows to explicitly define another control as the target of a routed
- command.
-
-
-----------------------------------------------------------------------------
-
-1.0.2 (2009.05.18)
-*****
-FIX Late-bound DataContext did not coerce properly with ContextMenu, thus
- assigning it the TaskbarIcon rather than the TaskbarIcon's DataContext.
- Thanks Nic Pillinger for discovering the issue.
-
-
-----------------------------------------------------------------------------
-
-1.0.1 (2009.05.15)
-*****
-CHG DataContext is also assigned to ContextMenu (thanks Nic Pillinger),
- and properly coerced for ToolTips and Popups. Also checks whether
- target item has a binding on the DataContext
- (does not just override if DataContext is null).
-CHG Popup creation no longer calls Popup.CreateRootPopup which tries to
- bind to dependency properties that do not exist, thus causing debug
- warnings (thanks to Loic Berthollet).
-CHG The LeftClickCommand now executes with a delay in order to make sure
- it's not a double-click.
-FIX Removed debug output in WindowMessageSink.
-
-
-----------------------------------------------------------------------------
-
-1.0.0
-*****
+hardcodet.net NotifyIcon for WPF - Changelog
+Copyright (c) 2009-2013 Philipp Sumi
+Contact and Information: http://www.hardcodet.net
+
+
+1.0.5 (2013.11.20)
+*****
+
+FIX Support for x64 applications targeting .NET 4 x64 or higher (big thanks to Mark Junker for submitting a patch!)
+CHG Component does no longer throw an exception is no Explorer shell is present,
+ but waits for it to be created.
+CHG NotifyIcon is not only removed on user-initiated disposal, but also garbage collection.
+CHG The attached ParentTaskbarIconProperty is now derived, so data binding to the attached DP
+ becomes much simpler
+ (e.g. )
+CHG WinAPI interop now uses Unicode in order to prevent issues with Asian languages. Thanks to JO Hyeong-Ryeol for posting an easy fix!
+FIX Context menues receiving keyboard events, which allows for TextBoxes in context menus.
+FIX Coordinates calculated properly on operating systems with non-standard DPIs. Thanks Rusi Filipov for bug reporting and testing.
+FIX Data-bound ToolTipText may have caused ToolTips to remain open in case of property changes.
+
+
+----------------------------------------------------------------------------
+
+1.0.4 (2009.09.21)
+*****
+
+FIX If a popup is opened, its window handle is now being set as the foreground.
+ This fixes an issue with certain controls being disabled on popups.
+ (thanks Andrew Smith for pointing me in the right direction!).
+FIX Changed dispatcher access in order to work in WinForms scenarios, too.
+FIX Corrected typo in WindowMessageSink.BalloonToolTipChanged event (thanks Mertsch).
+ Used internally (although event is public), so this shouldn't be a breaking change.
+FIX Dispose only deregisters OnExit event listenter if there is actually an
+ application (not the case in WinForms environments).
+
+
+----------------------------------------------------------------------------
+
+1.0.3 (2009.07.02)
+*****
+FIX Commands did not work with RoutedCommands which require an explicit target
+ (thanks Rodolfo Grave).
+ADD Added command target properties for both left and double click commands.
+ Allows to explicitly define another control as the target of a routed
+ command.
+
+
+----------------------------------------------------------------------------
+
+1.0.2 (2009.05.18)
+*****
+FIX Late-bound DataContext did not coerce properly with ContextMenu, thus
+ assigning it the TaskbarIcon rather than the TaskbarIcon's DataContext.
+ Thanks Nic Pillinger for discovering the issue.
+
+
+----------------------------------------------------------------------------
+
+1.0.1 (2009.05.15)
+*****
+CHG DataContext is also assigned to ContextMenu (thanks Nic Pillinger),
+ and properly coerced for ToolTips and Popups. Also checks whether
+ target item has a binding on the DataContext
+ (does not just override if DataContext is null).
+CHG Popup creation no longer calls Popup.CreateRootPopup which tries to
+ bind to dependency properties that do not exist, thus causing debug
+ warnings (thanks to Loic Berthollet).
+CHG The LeftClickCommand now executes with a delay in order to make sure
+ it's not a double-click.
+FIX Removed debug output in WindowMessageSink.
+
+
+----------------------------------------------------------------------------
+
+1.0.0
+*****
ADD Initial release.
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Cleanup_Solution_For_Deployment.bat b/Hardcodet.NotifyIcon.Wpf/Source/Cleanup_Solution_For_Deployment.bat
index 1f49792..01581a4 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Cleanup_Solution_For_Deployment.bat
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Cleanup_Solution_For_Deployment.bat
@@ -1,20 +1,20 @@
-del /s /ah /f *.suo
-del /s /f *.user
-del /s /f *.cache
-del /s /f *.scc
-del /s /f *.vssscc
-del /s /f *.vspscc
-del /s /f *.keep
-del /s /ah /f vssver2.scc
-
-rd /s /q bin obj ClientBin _Resharper.* _Upgrade*
-
-del dirs.txt
-dir /s /b /ad bin > dirs.txt
-dir /s /b /ad obj >> dirs.txt
-dir /s /b /ad ClientBin >> dirs.txt
-dir /s /b /ad _Resharper.* >> dirs.txt
-dir /s /b /ad _Upgrade* >> dirs.txt
-
-for /f "delims=;" %%i in (dirs.txt) DO rd /s /q "%%i"
-del dirs.txt
+del /s /ah /f *.suo
+del /s /f *.user
+del /s /f *.cache
+del /s /f *.scc
+del /s /f *.vssscc
+del /s /f *.vspscc
+del /s /f *.keep
+del /s /ah /f vssver2.scc
+
+rd /s /q bin obj ClientBin _Resharper.* _Upgrade*
+
+del dirs.txt
+dir /s /b /ad bin > dirs.txt
+dir /s /b /ad obj >> dirs.txt
+dir /s /b /ad ClientBin >> dirs.txt
+dir /s /b /ad _Resharper.* >> dirs.txt
+dir /s /b /ad _Upgrade* >> dirs.txt
+
+for /f "delims=;" %%i in (dirs.txt) DO rd /s /q "%%i"
+del dirs.txt
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf.sln b/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf.sln
index e188016..acefad4 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf.sln
+++ b/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf.sln
@@ -1,45 +1,45 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2013
-VisualStudioVersion = 12.0.21005.1
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C37AE34D-A8C4-4AEC-995C-3C763300934E}"
- ProjectSection(SolutionItems) = preProject
- Changelog.txt = Changelog.txt
- EndProjectSection
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NotifyIconWpf", "NotifyIconWpf\NotifyIconWpf.csproj", "{7AC63864-7638-41C4-969C-D3197EF2BED9}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample Project", "Sample Project\Sample Project.csproj", "{71C74F29-F1C2-49C5-969F-C25AC4CDFCCC}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsFormsSample", "WindowsFormsSample\WindowsFormsSample.csproj", "{F6DC0A6D-D1CE-4AD2-92ED-08FFF0AD4FA8}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Windowless Sample", "Windowless Sample\Windowless Sample.csproj", "{964EBFBE-A600-49B2-BDD8-422B46F1D544}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {7AC63864-7638-41C4-969C-D3197EF2BED9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {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
- {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
- {71C74F29-F1C2-49C5-969F-C25AC4CDFCCC}.Release|Any CPU.Build.0 = Release|Any CPU
- {F6DC0A6D-D1CE-4AD2-92ED-08FFF0AD4FA8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {F6DC0A6D-D1CE-4AD2-92ED-08FFF0AD4FA8}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {F6DC0A6D-D1CE-4AD2-92ED-08FFF0AD4FA8}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {F6DC0A6D-D1CE-4AD2-92ED-08FFF0AD4FA8}.Release|Any CPU.Build.0 = Release|Any CPU
- {964EBFBE-A600-49B2-BDD8-422B46F1D544}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {964EBFBE-A600-49B2-BDD8-422B46F1D544}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {964EBFBE-A600-49B2-BDD8-422B46F1D544}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {964EBFBE-A600-49B2-BDD8-422B46F1D544}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2013
+VisualStudioVersion = 12.0.21005.1
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C37AE34D-A8C4-4AEC-995C-3C763300934E}"
+ ProjectSection(SolutionItems) = preProject
+ Changelog.txt = Changelog.txt
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NotifyIconWpf", "NotifyIconWpf\NotifyIconWpf.csproj", "{7AC63864-7638-41C4-969C-D3197EF2BED9}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample Project", "Sample Project\Sample Project.csproj", "{71C74F29-F1C2-49C5-969F-C25AC4CDFCCC}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsFormsSample", "WindowsFormsSample\WindowsFormsSample.csproj", "{F6DC0A6D-D1CE-4AD2-92ED-08FFF0AD4FA8}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Windowless Sample", "Windowless Sample\Windowless Sample.csproj", "{964EBFBE-A600-49B2-BDD8-422B46F1D544}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {7AC63864-7638-41C4-969C-D3197EF2BED9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {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
+ {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
+ {71C74F29-F1C2-49C5-969F-C25AC4CDFCCC}.Release|Any CPU.Build.0 = Release|Any CPU
+ {F6DC0A6D-D1CE-4AD2-92ED-08FFF0AD4FA8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {F6DC0A6D-D1CE-4AD2-92ED-08FFF0AD4FA8}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {F6DC0A6D-D1CE-4AD2-92ED-08FFF0AD4FA8}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {F6DC0A6D-D1CE-4AD2-92ED-08FFF0AD4FA8}.Release|Any CPU.Build.0 = Release|Any CPU
+ {964EBFBE-A600-49B2-BDD8-422B46F1D544}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {964EBFBE-A600-49B2-BDD8-422B46F1D544}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {964EBFBE-A600-49B2-BDD8-422B46F1D544}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {964EBFBE-A600-49B2-BDD8-422B46F1D544}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/BalloonIcon.cs b/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/BalloonIcon.cs
index e8e630a..4979133 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/BalloonIcon.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/BalloonIcon.cs
@@ -1,52 +1,52 @@
-// hardcodet.net NotifyIcon for WPF
-// Copyright (c) 2009 - 2013 Philipp Sumi
-// Contact and Information: http://www.hardcodet.net
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the Code Project Open License (CPOL);
-// either version 1.0 of the License, or (at your option) any later
-// version.
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-//
-// THIS COPYRIGHT NOTICE MAY NOT BE REMOVED FROM THIS FILE
-
-
-namespace Hardcodet.Wpf.TaskbarNotification
-{
- ///
- /// Supported icons for the tray's balloon messages.
- ///
- public enum BalloonIcon
- {
- ///
- /// The balloon message is displayed without an icon.
- ///
- None,
-
- ///
- /// An information is displayed.
- ///
- Info,
-
- ///
- /// A warning is displayed.
- ///
- Warning,
-
- ///
- /// An error is displayed.
- ///
- Error
- }
+// hardcodet.net NotifyIcon for WPF
+// Copyright (c) 2009 - 2013 Philipp Sumi
+// Contact and Information: http://www.hardcodet.net
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the Code Project Open License (CPOL);
+// either version 1.0 of the License, or (at your option) any later
+// version.
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+//
+// THIS COPYRIGHT NOTICE MAY NOT BE REMOVED FROM THIS FILE
+
+
+namespace Hardcodet.Wpf.TaskbarNotification
+{
+ ///
+ /// Supported icons for the tray's balloon messages.
+ ///
+ public enum BalloonIcon
+ {
+ ///
+ /// The balloon message is displayed without an icon.
+ ///
+ None,
+
+ ///
+ /// An information is displayed.
+ ///
+ Info,
+
+ ///
+ /// A warning is displayed.
+ ///
+ Warning,
+
+ ///
+ /// An error is displayed.
+ ///
+ Error
+ }
}
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Diagrams/TaskbarIcon Overview.cd b/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Diagrams/TaskbarIcon Overview.cd
index e368a8f..b43adff 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Diagrams/TaskbarIcon Overview.cd
+++ b/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Diagrams/TaskbarIcon Overview.cd
@@ -1,30 +1,30 @@
-
-
-
-
-
-
-
-
-
- N6qdVIeUdLmQtSUbiJhEGdYRjvJYXlhbEVBDKuPRO5s=
- TaskbarIcon.cs
-
-
-
-
-
-
- ABAEAAAAAAAAAAABAAAAAAAAAAAAAAAAAIAKAIAAAAA=
- PopupActivationMode.cs
-
-
-
-
-
- AAAAAAAAAAAAAQAAAAAAABAAAAAAAAAAAAAAAEEAAAA=
- BalloonIcon.cs
-
-
-
+
+
+
+
+
+
+
+
+
+ N6qdVIeUdLmQtSUbiJhEGdYRjvJYXlhbEVBDKuPRO5s=
+ TaskbarIcon.cs
+
+
+
+
+
+
+ ABAEAAAAAAAAAAABAAAAAAAAAAAAAAAAAIAKAIAAAAA=
+ PopupActivationMode.cs
+
+
+
+
+
+ AAAAAAAAAAAAAQAAAAAAABAAAAAAAAAAAAAAAEEAAAA=
+ BalloonIcon.cs
+
+
+
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Interop/BalloonFlags.cs b/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Interop/BalloonFlags.cs
index 0243003..2e02633 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Interop/BalloonFlags.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Interop/BalloonFlags.cs
@@ -1,61 +1,61 @@
-namespace Hardcodet.Wpf.TaskbarNotification.Interop
-{
- ///
- /// Flags that define the icon that is shown on a balloon
- /// tooltip.
- ///
- public enum BalloonFlags
- {
- ///
- /// No icon is displayed.
- ///
- None = 0x00,
-
- ///
- /// An information icon is displayed.
- ///
- Info = 0x01,
-
- ///
- /// A warning icon is displayed.
- ///
- Warning = 0x02,
-
- ///
- /// An error icon is displayed.
- ///
- Error = 0x03,
-
- ///
- /// Windows XP Service Pack 2 (SP2) and later.
- /// Use a custom icon as the title icon.
- ///
- User = 0x04,
-
- ///
- /// Windows XP (Shell32.dll version 6.0) and later.
- /// Do not play the associated sound. Applies only to balloon ToolTips.
- ///
- NoSound = 0x10,
-
- ///
- /// Windows Vista (Shell32.dll version 6.0.6) and later. The large version
- /// of the icon should be used as the balloon icon. This corresponds to the
- /// icon with dimensions SM_CXICON x SM_CYICON. If this flag is not set,
- /// the icon with dimensions XM_CXSMICON x SM_CYSMICON is used.
- /// - This flag can be used with all stock icons.
- /// - Applications that use older customized icons (NIIF_USER with hIcon) must
- /// provide a new SM_CXICON x SM_CYICON version in the tray icon (hIcon). These
- /// icons are scaled down when they are displayed in the System Tray or
- /// System Control Area (SCA).
- /// - New customized icons (NIIF_USER with hBalloonIcon) must supply an
- /// SM_CXICON x SM_CYICON version in the supplied icon (hBalloonIcon).
- ///
- LargeIcon = 0x20,
-
- ///
- /// Windows 7 and later.
- ///
- RespectQuietTime = 0x80
- }
+namespace Hardcodet.Wpf.TaskbarNotification.Interop
+{
+ ///
+ /// Flags that define the icon that is shown on a balloon
+ /// tooltip.
+ ///
+ public enum BalloonFlags
+ {
+ ///
+ /// No icon is displayed.
+ ///
+ None = 0x00,
+
+ ///
+ /// An information icon is displayed.
+ ///
+ Info = 0x01,
+
+ ///
+ /// A warning icon is displayed.
+ ///
+ Warning = 0x02,
+
+ ///
+ /// An error icon is displayed.
+ ///
+ Error = 0x03,
+
+ ///
+ /// Windows XP Service Pack 2 (SP2) and later.
+ /// Use a custom icon as the title icon.
+ ///
+ User = 0x04,
+
+ ///
+ /// Windows XP (Shell32.dll version 6.0) and later.
+ /// Do not play the associated sound. Applies only to balloon ToolTips.
+ ///
+ NoSound = 0x10,
+
+ ///
+ /// Windows Vista (Shell32.dll version 6.0.6) and later. The large version
+ /// of the icon should be used as the balloon icon. This corresponds to the
+ /// icon with dimensions SM_CXICON x SM_CYICON. If this flag is not set,
+ /// the icon with dimensions XM_CXSMICON x SM_CYSMICON is used.
+ /// - This flag can be used with all stock icons.
+ /// - Applications that use older customized icons (NIIF_USER with hIcon) must
+ /// provide a new SM_CXICON x SM_CYICON version in the tray icon (hIcon). These
+ /// icons are scaled down when they are displayed in the System Tray or
+ /// System Control Area (SCA).
+ /// - New customized icons (NIIF_USER with hBalloonIcon) must supply an
+ /// SM_CXICON x SM_CYICON version in the supplied icon (hBalloonIcon).
+ ///
+ LargeIcon = 0x20,
+
+ ///
+ /// Windows 7 and later.
+ ///
+ RespectQuietTime = 0x80
+ }
}
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Interop/IconDataMembers.cs b/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Interop/IconDataMembers.cs
index 75b05cf..c96d478 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Interop/IconDataMembers.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Interop/IconDataMembers.cs
@@ -1,70 +1,70 @@
-using System;
-
-namespace Hardcodet.Wpf.TaskbarNotification.Interop
-{
- ///
- /// Indicates which members of a structure
- /// were set, and thus contain valid data or provide additional information
- /// to the ToolTip as to how it should display.
- ///
- [Flags]
- public enum IconDataMembers
- {
- ///
- /// The message ID is set.
- ///
- Message = 0x01,
-
- ///
- /// The notification icon is set.
- ///
- Icon = 0x02,
-
- ///
- /// The tooltip is set.
- ///
- Tip = 0x04,
-
- ///
- /// State information () is set. This
- /// applies to both and
- /// .
- ///
- State = 0x08,
-
- ///
- /// The balloon ToolTip is set. Accordingly, the following
- /// members are set: ,
- /// , ,
- /// and .
- ///
- Info = 0x10,
-
- // Internal identifier is set. Reserved, thus commented out.
- //Guid = 0x20,
-
- ///
- /// Windows Vista (Shell32.dll version 6.0.6) and later. If the ToolTip
- /// cannot be displayed immediately, discard it.
- /// Use this flag for ToolTips that represent real-time information which
- /// would be meaningless or misleading if displayed at a later time.
- /// For example, a message that states "Your telephone is ringing."
- /// This modifies and must be combined with the flag.
- ///
- Realtime = 0x40,
-
- ///
- /// Windows Vista (Shell32.dll version 6.0.6) and later.
- /// Use the standard ToolTip. Normally, when uVersion is set
- /// to NOTIFYICON_VERSION_4, the standard ToolTip is replaced
- /// by the application-drawn pop-up user interface (UI).
- /// If the application wants to show the standard tooltip
- /// in that case, regardless of whether the on-hover UI is showing,
- /// it can specify NIF_SHOWTIP to indicate the standard tooltip
- /// should still be shown.
- /// Note that the NIF_SHOWTIP flag is effective until the next call
- /// to Shell_NotifyIcon.
- ///
- UseLegacyToolTips = 0x80
- }
+using System;
+
+namespace Hardcodet.Wpf.TaskbarNotification.Interop
+{
+ ///
+ /// Indicates which members of a structure
+ /// were set, and thus contain valid data or provide additional information
+ /// to the ToolTip as to how it should display.
+ ///
+ [Flags]
+ public enum IconDataMembers
+ {
+ ///
+ /// The message ID is set.
+ ///
+ Message = 0x01,
+
+ ///
+ /// The notification icon is set.
+ ///
+ Icon = 0x02,
+
+ ///
+ /// The tooltip is set.
+ ///
+ Tip = 0x04,
+
+ ///
+ /// State information () is set. This
+ /// applies to both and
+ /// .
+ ///
+ State = 0x08,
+
+ ///
+ /// The balloon ToolTip is set. Accordingly, the following
+ /// members are set: ,
+ /// , ,
+ /// and .
+ ///
+ Info = 0x10,
+
+ // Internal identifier is set. Reserved, thus commented out.
+ //Guid = 0x20,
+
+ ///
+ /// Windows Vista (Shell32.dll version 6.0.6) and later. If the ToolTip
+ /// cannot be displayed immediately, discard it.
+ /// Use this flag for ToolTips that represent real-time information which
+ /// would be meaningless or misleading if displayed at a later time.
+ /// For example, a message that states "Your telephone is ringing."
+ /// This modifies and must be combined with the flag.
+ ///
+ Realtime = 0x40,
+
+ ///
+ /// Windows Vista (Shell32.dll version 6.0.6) and later.
+ /// Use the standard ToolTip. Normally, when uVersion is set
+ /// to NOTIFYICON_VERSION_4, the standard ToolTip is replaced
+ /// by the application-drawn pop-up user interface (UI).
+ /// If the application wants to show the standard tooltip
+ /// in that case, regardless of whether the on-hover UI is showing,
+ /// it can specify NIF_SHOWTIP to indicate the standard tooltip
+ /// should still be shown.
+ /// Note that the NIF_SHOWTIP flag is effective until the next call
+ /// to Shell_NotifyIcon.
+ ///
+ UseLegacyToolTips = 0x80
+ }
}
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Interop/IconState.cs b/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Interop/IconState.cs
index 9238dd0..7fb7f26 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Interop/IconState.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Interop/IconState.cs
@@ -1,22 +1,22 @@
-namespace Hardcodet.Wpf.TaskbarNotification.Interop
-{
- ///
- /// The state of the icon - can be set to
- /// hide the icon.
- ///
- public enum IconState
- {
- ///
- /// The icon is visible.
- ///
- Visible = 0x00,
-
- ///
- /// Hide the icon.
- ///
- Hidden = 0x01,
-
- // The icon is shared - currently not supported, thus commented out.
- //Shared = 0x02
- }
+namespace Hardcodet.Wpf.TaskbarNotification.Interop
+{
+ ///
+ /// The state of the icon - can be set to
+ /// hide the icon.
+ ///
+ public enum IconState
+ {
+ ///
+ /// The icon is visible.
+ ///
+ Visible = 0x00,
+
+ ///
+ /// Hide the icon.
+ ///
+ Hidden = 0x01,
+
+ // The icon is shared - currently not supported, thus commented out.
+ //Shared = 0x02
+ }
}
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Interop/MouseEvent.cs b/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Interop/MouseEvent.cs
index 3aec31c..fc70578 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Interop/MouseEvent.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Interop/MouseEvent.cs
@@ -1,54 +1,54 @@
-namespace Hardcodet.Wpf.TaskbarNotification.Interop
-{
- ///
- /// Event flags for clicked events.
- ///
- public enum MouseEvent
- {
- ///
- /// The mouse was moved withing the
- /// taskbar icon's area.
- ///
- MouseMove,
-
- ///
- /// The right mouse button was clicked.
- ///
- IconRightMouseDown,
-
- ///
- /// The left mouse button was clicked.
- ///
- IconLeftMouseDown,
-
- ///
- /// The right mouse button was released.
- ///
- IconRightMouseUp,
-
- ///
- /// The left mouse button was released.
- ///
- IconLeftMouseUp,
-
- ///
- /// The middle mouse button was clicked.
- ///
- IconMiddleMouseDown,
-
- ///
- /// The middle mouse button was released.
- ///
- IconMiddleMouseUp,
-
- ///
- /// The taskbar icon was double clicked.
- ///
- IconDoubleClick,
-
- ///
- /// The balloon tip was clicked.
- ///
- BalloonToolTipClicked
- }
+namespace Hardcodet.Wpf.TaskbarNotification.Interop
+{
+ ///
+ /// Event flags for clicked events.
+ ///
+ public enum MouseEvent
+ {
+ ///
+ /// The mouse was moved withing the
+ /// taskbar icon's area.
+ ///
+ MouseMove,
+
+ ///
+ /// The right mouse button was clicked.
+ ///
+ IconRightMouseDown,
+
+ ///
+ /// The left mouse button was clicked.
+ ///
+ IconLeftMouseDown,
+
+ ///
+ /// The right mouse button was released.
+ ///
+ IconRightMouseUp,
+
+ ///
+ /// The left mouse button was released.
+ ///
+ IconLeftMouseUp,
+
+ ///
+ /// The middle mouse button was clicked.
+ ///
+ IconMiddleMouseDown,
+
+ ///
+ /// The middle mouse button was released.
+ ///
+ IconMiddleMouseUp,
+
+ ///
+ /// The taskbar icon was double clicked.
+ ///
+ IconDoubleClick,
+
+ ///
+ /// The balloon tip was clicked.
+ ///
+ BalloonToolTipClicked
+ }
}
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Interop/NotifyCommand.cs b/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Interop/NotifyCommand.cs
index 3e72985..12e134c 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Interop/NotifyCommand.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Interop/NotifyCommand.cs
@@ -1,41 +1,41 @@
-namespace Hardcodet.Wpf.TaskbarNotification.Interop
-{
- ///
- /// Main operations performed on the
- /// function.
- ///
- public enum NotifyCommand
- {
- ///
- /// The taskbar icon is being created.
- ///
- Add = 0x00,
-
- ///
- /// The settings of the taskbar icon are being updated.
- ///
- Modify = 0x01,
-
- ///
- /// The taskbar icon is deleted.
- ///
- Delete = 0x02,
-
- ///
- /// Focus is returned to the taskbar icon. Currently not in use.
- ///
- SetFocus = 0x03,
-
- ///
- /// Shell32.dll version 5.0 and later only. Instructs the taskbar
- /// to behave according to the version number specified in the
- /// uVersion member of the structure pointed to by lpdata.
- /// This message allows you to specify whether you want the version
- /// 5.0 behavior found on Microsoft Windows 2000 systems, or the
- /// behavior found on earlier Shell versions. The default value for
- /// uVersion is zero, indicating that the original Windows 95 notify
- /// icon behavior should be used.
- ///
- SetVersion = 0x04
- }
+namespace Hardcodet.Wpf.TaskbarNotification.Interop
+{
+ ///
+ /// Main operations performed on the
+ /// function.
+ ///
+ public enum NotifyCommand
+ {
+ ///
+ /// The taskbar icon is being created.
+ ///
+ Add = 0x00,
+
+ ///
+ /// The settings of the taskbar icon are being updated.
+ ///
+ Modify = 0x01,
+
+ ///
+ /// The taskbar icon is deleted.
+ ///
+ Delete = 0x02,
+
+ ///
+ /// Focus is returned to the taskbar icon. Currently not in use.
+ ///
+ SetFocus = 0x03,
+
+ ///
+ /// Shell32.dll version 5.0 and later only. Instructs the taskbar
+ /// to behave according to the version number specified in the
+ /// uVersion member of the structure pointed to by lpdata.
+ /// This message allows you to specify whether you want the version
+ /// 5.0 behavior found on Microsoft Windows 2000 systems, or the
+ /// behavior found on earlier Shell versions. The default value for
+ /// uVersion is zero, indicating that the original Windows 95 notify
+ /// icon behavior should be used.
+ ///
+ SetVersion = 0x04
+ }
}
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Interop/NotifyIconData.cs b/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Interop/NotifyIconData.cs
index 59f8f13..e51db51 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Interop/NotifyIconData.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Interop/NotifyIconData.cs
@@ -1,165 +1,165 @@
-using System;
-using System.Runtime.InteropServices;
-
-namespace Hardcodet.Wpf.TaskbarNotification.Interop
-{
- ///
- /// A struct that is submitted in order to configure
- /// the taskbar icon. Provides various members that
- /// can be configured partially, according to the
- /// values of the
- /// that were defined.
- ///
- [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
- public struct NotifyIconData
- {
- ///
- /// Size of this structure, in bytes.
- ///
- public uint cbSize;
-
- ///
- /// Handle to the window that receives notification messages associated with an icon in the
- /// taskbar status area. The Shell uses hWnd and uID to identify which icon to operate on
- /// when Shell_NotifyIcon is invoked.
- ///
- public IntPtr WindowHandle;
-
- ///
- /// Application-defined identifier of the taskbar icon. The Shell uses hWnd and uID to identify
- /// which icon to operate on when Shell_NotifyIcon is invoked. You can have multiple icons
- /// associated with a single hWnd by assigning each a different uID. This feature, however
- /// is currently not used.
- ///
- public uint TaskbarIconId;
-
- ///
- /// Flags that indicate which of the other members contain valid data. This member can be
- /// a combination of the NIF_XXX constants.
- ///
- public IconDataMembers ValidMembers;
-
- ///
- /// Application-defined message identifier. The system uses this identifier to send
- /// notifications to the window identified in hWnd.
- ///
- public uint CallbackMessageId;
-
- ///
- /// A handle to the icon that should be displayed. Just
- /// Icon.Handle.
- ///
- public IntPtr IconHandle;
-
- ///
- /// String with the text for a standard ToolTip. It can have a maximum of 64 characters including
- /// the terminating NULL. For Version 5.0 and later, szTip can have a maximum of
- /// 128 characters, including the terminating NULL.
- ///
- [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] public string ToolTipText;
-
-
- ///
- /// State of the icon. Remember to also set the .
- ///
- public IconState IconState;
-
- ///
- /// A value that specifies which bits of the state member are retrieved or modified.
- /// For example, setting this member to
- /// causes only the item's hidden
- /// state to be retrieved.
- ///
- public IconState StateMask;
-
- ///
- /// String with the text for a balloon ToolTip. It can have a maximum of 255 characters.
- /// To remove the ToolTip, set the NIF_INFO flag in uFlags and set szInfo to an empty string.
- ///
- [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public string BalloonText;
-
- ///
- /// Mainly used to set the version when is invoked
- /// with . However, for legacy operations,
- /// the same member is also used to set timouts for balloon ToolTips.
- ///
- public uint VersionOrTimeout;
-
- ///
- /// String containing a title for a balloon ToolTip. This title appears in boldface
- /// above the text. It can have a maximum of 63 characters.
- ///
- [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] public string BalloonTitle;
-
- ///
- /// Adds an icon to a balloon ToolTip, which is placed to the left of the title. If the
- /// member is zero-length, the icon is not shown.
- ///
- public BalloonFlags BalloonFlags;
-
- ///
- /// Windows XP (Shell32.dll version 6.0) and later.
- /// - Windows 7 and later: A registered GUID that identifies the icon.
- /// This value overrides uID and is the recommended method of identifying the icon.
- /// - Windows XP through Windows Vista: Reserved.
- ///
- public Guid TaskbarIconGuid;
-
- ///
- /// Windows Vista (Shell32.dll version 6.0.6) and later. The handle of a customized
- /// balloon icon provided by the application that should be used independently
- /// of the tray icon. If this member is non-NULL and the
- /// flag is set, this icon is used as the balloon icon.
- /// If this member is NULL, the legacy behavior is carried out.
- ///
- public IntPtr CustomBalloonIconHandle;
-
-
- ///
- /// Creates a default data structure that provides
- /// a hidden taskbar icon without the icon being set.
- ///
- ///
- ///
- public static NotifyIconData CreateDefault(IntPtr handle)
- {
- var data = new NotifyIconData();
-
- 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 = 952; // NOTIFYICONDATAW_V3_SIZE
-
- //set to fixed timeout
- data.VersionOrTimeout = 10;
- }
-
- data.WindowHandle = handle;
- data.TaskbarIconId = 0x0;
- data.CallbackMessageId = WindowMessageSink.CallbackMessageId;
- data.VersionOrTimeout = (uint) NotifyIconVersion.Win95;
-
- data.IconHandle = IntPtr.Zero;
-
- //hide initially
- data.IconState = IconState.Hidden;
- data.StateMask = IconState.Hidden;
-
- //set flags
- data.ValidMembers = IconDataMembers.Message
- | IconDataMembers.Icon
- | IconDataMembers.Tip;
-
- //reset strings
- data.ToolTipText = data.BalloonText = data.BalloonTitle = String.Empty;
-
- return data;
- }
- }
+using System;
+using System.Runtime.InteropServices;
+
+namespace Hardcodet.Wpf.TaskbarNotification.Interop
+{
+ ///
+ /// A struct that is submitted in order to configure
+ /// the taskbar icon. Provides various members that
+ /// can be configured partially, according to the
+ /// values of the
+ /// that were defined.
+ ///
+ [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
+ public struct NotifyIconData
+ {
+ ///
+ /// Size of this structure, in bytes.
+ ///
+ public uint cbSize;
+
+ ///
+ /// Handle to the window that receives notification messages associated with an icon in the
+ /// taskbar status area. The Shell uses hWnd and uID to identify which icon to operate on
+ /// when Shell_NotifyIcon is invoked.
+ ///
+ public IntPtr WindowHandle;
+
+ ///
+ /// Application-defined identifier of the taskbar icon. The Shell uses hWnd and uID to identify
+ /// which icon to operate on when Shell_NotifyIcon is invoked. You can have multiple icons
+ /// associated with a single hWnd by assigning each a different uID. This feature, however
+ /// is currently not used.
+ ///
+ public uint TaskbarIconId;
+
+ ///
+ /// Flags that indicate which of the other members contain valid data. This member can be
+ /// a combination of the NIF_XXX constants.
+ ///
+ public IconDataMembers ValidMembers;
+
+ ///
+ /// Application-defined message identifier. The system uses this identifier to send
+ /// notifications to the window identified in hWnd.
+ ///
+ public uint CallbackMessageId;
+
+ ///
+ /// A handle to the icon that should be displayed. Just
+ /// Icon.Handle.
+ ///
+ public IntPtr IconHandle;
+
+ ///
+ /// String with the text for a standard ToolTip. It can have a maximum of 64 characters including
+ /// the terminating NULL. For Version 5.0 and later, szTip can have a maximum of
+ /// 128 characters, including the terminating NULL.
+ ///
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] public string ToolTipText;
+
+
+ ///
+ /// State of the icon. Remember to also set the .
+ ///
+ public IconState IconState;
+
+ ///
+ /// A value that specifies which bits of the state member are retrieved or modified.
+ /// For example, setting this member to
+ /// causes only the item's hidden
+ /// state to be retrieved.
+ ///
+ public IconState StateMask;
+
+ ///
+ /// String with the text for a balloon ToolTip. It can have a maximum of 255 characters.
+ /// To remove the ToolTip, set the NIF_INFO flag in uFlags and set szInfo to an empty string.
+ ///
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public string BalloonText;
+
+ ///
+ /// Mainly used to set the version when is invoked
+ /// with . However, for legacy operations,
+ /// the same member is also used to set timouts for balloon ToolTips.
+ ///
+ public uint VersionOrTimeout;
+
+ ///
+ /// String containing a title for a balloon ToolTip. This title appears in boldface
+ /// above the text. It can have a maximum of 63 characters.
+ ///
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] public string BalloonTitle;
+
+ ///
+ /// Adds an icon to a balloon ToolTip, which is placed to the left of the title. If the
+ /// member is zero-length, the icon is not shown.
+ ///
+ public BalloonFlags BalloonFlags;
+
+ ///
+ /// Windows XP (Shell32.dll version 6.0) and later.
+ /// - Windows 7 and later: A registered GUID that identifies the icon.
+ /// This value overrides uID and is the recommended method of identifying the icon.
+ /// - Windows XP through Windows Vista: Reserved.
+ ///
+ public Guid TaskbarIconGuid;
+
+ ///
+ /// Windows Vista (Shell32.dll version 6.0.6) and later. The handle of a customized
+ /// balloon icon provided by the application that should be used independently
+ /// of the tray icon. If this member is non-NULL and the
+ /// flag is set, this icon is used as the balloon icon.
+ /// If this member is NULL, the legacy behavior is carried out.
+ ///
+ public IntPtr CustomBalloonIconHandle;
+
+
+ ///
+ /// Creates a default data structure that provides
+ /// a hidden taskbar icon without the icon being set.
+ ///
+ ///
+ ///
+ public static NotifyIconData CreateDefault(IntPtr handle)
+ {
+ var data = new NotifyIconData();
+
+ 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 = 952; // NOTIFYICONDATAW_V3_SIZE
+
+ //set to fixed timeout
+ data.VersionOrTimeout = 10;
+ }
+
+ data.WindowHandle = handle;
+ data.TaskbarIconId = 0x0;
+ data.CallbackMessageId = WindowMessageSink.CallbackMessageId;
+ data.VersionOrTimeout = (uint) NotifyIconVersion.Win95;
+
+ data.IconHandle = IntPtr.Zero;
+
+ //hide initially
+ data.IconState = IconState.Hidden;
+ data.StateMask = IconState.Hidden;
+
+ //set flags
+ data.ValidMembers = IconDataMembers.Message
+ | IconDataMembers.Icon
+ | IconDataMembers.Tip;
+
+ //reset strings
+ data.ToolTipText = data.BalloonText = data.BalloonTitle = String.Empty;
+
+ return data;
+ }
+ }
}
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Interop/NotifyIconVersion.cs b/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Interop/NotifyIconVersion.cs
index 277f278..5e8a436 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Interop/NotifyIconVersion.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Interop/NotifyIconVersion.cs
@@ -1,27 +1,27 @@
-namespace Hardcodet.Wpf.TaskbarNotification.Interop
-{
- ///
- /// The notify icon version that is used. The higher
- /// the version, the more capabilities are available.
- ///
- public enum NotifyIconVersion
- {
- ///
- /// Default behavior (legacy Win95). Expects
- /// a size of 488.
- ///
- Win95 = 0x0,
-
- ///
- /// Behavior representing Win2000 an higher. Expects
- /// a size of 504.
- ///
- Win2000 = 0x3,
-
- ///
- /// Extended tooltip support, which is available
- /// for Vista and later.
- ///
- Vista = 0x4
- }
+namespace Hardcodet.Wpf.TaskbarNotification.Interop
+{
+ ///
+ /// The notify icon version that is used. The higher
+ /// the version, the more capabilities are available.
+ ///
+ public enum NotifyIconVersion
+ {
+ ///
+ /// Default behavior (legacy Win95). Expects
+ /// a size of 488.
+ ///
+ Win95 = 0x0,
+
+ ///
+ /// Behavior representing Win2000 an higher. Expects
+ /// a size of 504.
+ ///
+ Win2000 = 0x3,
+
+ ///
+ /// Extended tooltip support, which is available
+ /// for Vista and later.
+ ///
+ Vista = 0x4
+ }
}
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Interop/Point.cs b/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Interop/Point.cs
index 39e3e5e..585344f 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Interop/Point.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Interop/Point.cs
@@ -1,20 +1,20 @@
-using System.Runtime.InteropServices;
-
-namespace Hardcodet.Wpf.TaskbarNotification.Interop
-{
- ///
- /// Win API struct providing coordinates for a single point.
- ///
- [StructLayout(LayoutKind.Sequential)]
- public struct Point
- {
- ///
- /// X coordinate.
- ///
- public int X;
- ///
- /// Y coordinate.
- ///
- public int Y;
- }
+using System.Runtime.InteropServices;
+
+namespace Hardcodet.Wpf.TaskbarNotification.Interop
+{
+ ///
+ /// Win API struct providing coordinates for a single point.
+ ///
+ [StructLayout(LayoutKind.Sequential)]
+ public struct Point
+ {
+ ///
+ /// X coordinate.
+ ///
+ public int X;
+ ///
+ /// Y coordinate.
+ ///
+ public int Y;
+ }
}
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Interop/TrayInfo.cs b/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Interop/TrayInfo.cs
index 9ddc83f..468a833 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Interop/TrayInfo.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Interop/TrayInfo.cs
@@ -1,164 +1,164 @@
-// Some interop code taken from Mike Marshall's AnyForm
-
-using System;
-using System.Drawing;
-using System.Runtime.InteropServices;
-
-
-namespace Hardcodet.Wpf.TaskbarNotification.Interop
-{
- ///
- /// Resolves the current tray position.
- ///
- public static class TrayInfo
- {
- ///
- /// Gets the position of the system tray.
- ///
- /// Tray coordinates.
- public static Point GetTrayLocation()
- {
- var info = new AppBarInfo();
- info.GetSystemTaskBarPosition();
-
- Rectangle rcWorkArea = info.WorkArea;
-
- int x = 0, y = 0;
- if (info.Edge == AppBarInfo.ScreenEdge.Left)
- {
- x = rcWorkArea.Left + 2;
- y = rcWorkArea.Bottom;
- }
- else if (info.Edge == AppBarInfo.ScreenEdge.Bottom)
- {
- x = rcWorkArea.Right;
- y = rcWorkArea.Bottom;
- }
- else if (info.Edge == AppBarInfo.ScreenEdge.Top)
- {
- x = rcWorkArea.Right;
- y = rcWorkArea.Top;
- }
- else if (info.Edge == AppBarInfo.ScreenEdge.Right)
- {
- x = rcWorkArea.Right;
- y = rcWorkArea.Bottom;
- }
-
- return new Point {X = x, Y = y};
- }
- }
-
-
- internal class AppBarInfo
- {
- [DllImport("user32.dll")]
- private static extern IntPtr FindWindow(String lpClassName, String lpWindowName);
-
- [DllImport("shell32.dll")]
- private static extern UInt32 SHAppBarMessage(UInt32 dwMessage, ref APPBARDATA data);
-
- [DllImport("user32.dll")]
- private static extern Int32 SystemParametersInfo(UInt32 uiAction, UInt32 uiParam,
- IntPtr pvParam, UInt32 fWinIni);
-
-
- private const int ABE_BOTTOM = 3;
- private const int ABE_LEFT = 0;
- private const int ABE_RIGHT = 2;
- private const int ABE_TOP = 1;
-
- private const int ABM_GETTASKBARPOS = 0x00000005;
-
- // SystemParametersInfo constants
- private const UInt32 SPI_GETWORKAREA = 0x0030;
-
- private APPBARDATA m_data;
-
- public ScreenEdge Edge
- {
- get { return (ScreenEdge) m_data.uEdge; }
- }
-
-
- public Rectangle WorkArea
- {
- get
- {
- Int32 bResult = 0;
- var rc = new RECT();
- IntPtr rawRect = Marshal.AllocHGlobal(Marshal.SizeOf(rc));
- bResult = SystemParametersInfo(SPI_GETWORKAREA, 0, rawRect, 0);
- rc = (RECT) Marshal.PtrToStructure(rawRect, rc.GetType());
-
- if (bResult == 1)
- {
- Marshal.FreeHGlobal(rawRect);
- return new Rectangle(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top);
- }
-
- return new Rectangle(0, 0, 0, 0);
- }
- }
-
-
- public void GetPosition(string strClassName, string strWindowName)
- {
- m_data = new APPBARDATA();
- m_data.cbSize = (UInt32) Marshal.SizeOf(m_data.GetType());
-
- IntPtr hWnd = FindWindow(strClassName, strWindowName);
-
- if (hWnd != IntPtr.Zero)
- {
- UInt32 uResult = SHAppBarMessage(ABM_GETTASKBARPOS, ref m_data);
-
- if (uResult != 1)
- {
- throw new Exception("Failed to communicate with the given AppBar");
- }
- }
- else
- {
- throw new Exception("Failed to find an AppBar that matched the given criteria");
- }
- }
-
-
- public void GetSystemTaskBarPosition()
- {
- GetPosition("Shell_TrayWnd", null);
- }
-
-
- public enum ScreenEdge
- {
- Undefined = -1,
- Left = ABE_LEFT,
- Top = ABE_TOP,
- Right = ABE_RIGHT,
- Bottom = ABE_BOTTOM
- }
-
-
- [StructLayout(LayoutKind.Sequential)]
- private struct APPBARDATA
- {
- public UInt32 cbSize;
- public IntPtr hWnd;
- public UInt32 uCallbackMessage;
- public UInt32 uEdge;
- public RECT rc;
- public Int32 lParam;
- }
-
- [StructLayout(LayoutKind.Sequential)]
- private struct RECT
- {
- public Int32 left;
- public Int32 top;
- public Int32 right;
- public Int32 bottom;
- }
- }
+// Some interop code taken from Mike Marshall's AnyForm
+
+using System;
+using System.Drawing;
+using System.Runtime.InteropServices;
+
+
+namespace Hardcodet.Wpf.TaskbarNotification.Interop
+{
+ ///
+ /// Resolves the current tray position.
+ ///
+ public static class TrayInfo
+ {
+ ///
+ /// Gets the position of the system tray.
+ ///
+ /// Tray coordinates.
+ public static Point GetTrayLocation()
+ {
+ var info = new AppBarInfo();
+ info.GetSystemTaskBarPosition();
+
+ Rectangle rcWorkArea = info.WorkArea;
+
+ int x = 0, y = 0;
+ if (info.Edge == AppBarInfo.ScreenEdge.Left)
+ {
+ x = rcWorkArea.Left + 2;
+ y = rcWorkArea.Bottom;
+ }
+ else if (info.Edge == AppBarInfo.ScreenEdge.Bottom)
+ {
+ x = rcWorkArea.Right;
+ y = rcWorkArea.Bottom;
+ }
+ else if (info.Edge == AppBarInfo.ScreenEdge.Top)
+ {
+ x = rcWorkArea.Right;
+ y = rcWorkArea.Top;
+ }
+ else if (info.Edge == AppBarInfo.ScreenEdge.Right)
+ {
+ x = rcWorkArea.Right;
+ y = rcWorkArea.Bottom;
+ }
+
+ return new Point {X = x, Y = y};
+ }
+ }
+
+
+ internal class AppBarInfo
+ {
+ [DllImport("user32.dll")]
+ private static extern IntPtr FindWindow(String lpClassName, String lpWindowName);
+
+ [DllImport("shell32.dll")]
+ private static extern UInt32 SHAppBarMessage(UInt32 dwMessage, ref APPBARDATA data);
+
+ [DllImport("user32.dll")]
+ private static extern Int32 SystemParametersInfo(UInt32 uiAction, UInt32 uiParam,
+ IntPtr pvParam, UInt32 fWinIni);
+
+
+ private const int ABE_BOTTOM = 3;
+ private const int ABE_LEFT = 0;
+ private const int ABE_RIGHT = 2;
+ private const int ABE_TOP = 1;
+
+ private const int ABM_GETTASKBARPOS = 0x00000005;
+
+ // SystemParametersInfo constants
+ private const UInt32 SPI_GETWORKAREA = 0x0030;
+
+ private APPBARDATA m_data;
+
+ public ScreenEdge Edge
+ {
+ get { return (ScreenEdge) m_data.uEdge; }
+ }
+
+
+ public Rectangle WorkArea
+ {
+ get
+ {
+ Int32 bResult = 0;
+ var rc = new RECT();
+ IntPtr rawRect = Marshal.AllocHGlobal(Marshal.SizeOf(rc));
+ bResult = SystemParametersInfo(SPI_GETWORKAREA, 0, rawRect, 0);
+ rc = (RECT) Marshal.PtrToStructure(rawRect, rc.GetType());
+
+ if (bResult == 1)
+ {
+ Marshal.FreeHGlobal(rawRect);
+ return new Rectangle(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top);
+ }
+
+ return new Rectangle(0, 0, 0, 0);
+ }
+ }
+
+
+ public void GetPosition(string strClassName, string strWindowName)
+ {
+ m_data = new APPBARDATA();
+ m_data.cbSize = (UInt32) Marshal.SizeOf(m_data.GetType());
+
+ IntPtr hWnd = FindWindow(strClassName, strWindowName);
+
+ if (hWnd != IntPtr.Zero)
+ {
+ UInt32 uResult = SHAppBarMessage(ABM_GETTASKBARPOS, ref m_data);
+
+ if (uResult != 1)
+ {
+ throw new Exception("Failed to communicate with the given AppBar");
+ }
+ }
+ else
+ {
+ throw new Exception("Failed to find an AppBar that matched the given criteria");
+ }
+ }
+
+
+ public void GetSystemTaskBarPosition()
+ {
+ GetPosition("Shell_TrayWnd", null);
+ }
+
+
+ public enum ScreenEdge
+ {
+ Undefined = -1,
+ Left = ABE_LEFT,
+ Top = ABE_TOP,
+ Right = ABE_RIGHT,
+ Bottom = ABE_BOTTOM
+ }
+
+
+ [StructLayout(LayoutKind.Sequential)]
+ private struct APPBARDATA
+ {
+ public UInt32 cbSize;
+ public IntPtr hWnd;
+ public UInt32 uCallbackMessage;
+ public UInt32 uEdge;
+ public RECT rc;
+ public Int32 lParam;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ private struct RECT
+ {
+ public Int32 left;
+ public Int32 top;
+ public Int32 right;
+ public Int32 bottom;
+ }
+ }
}
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Interop/WinApi.cs b/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Interop/WinApi.cs
index 8aef54a..a3e4df2 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Interop/WinApi.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Interop/WinApi.cs
@@ -1,89 +1,89 @@
-using System;
-using System.Runtime.InteropServices;
-
-namespace Hardcodet.Wpf.TaskbarNotification.Interop
-{
- ///
- /// Win32 API imports.
- ///
- internal static class WinApi
- {
- ///
- /// Creates, updates or deletes the taskbar icon.
- ///
- [DllImport("shell32.Dll", CharSet = CharSet.Unicode)]
- public static extern bool Shell_NotifyIcon(NotifyCommand cmd, [In] ref NotifyIconData data);
-
-
- ///
- /// Creates the helper window that receives messages from the taskar icon.
- ///
- [DllImport("USER32.DLL", EntryPoint = "CreateWindowExW", SetLastError = true)]
- public static extern IntPtr CreateWindowEx(int dwExStyle, [MarshalAs(UnmanagedType.LPWStr)] string lpClassName,
- [MarshalAs(UnmanagedType.LPWStr)] string lpWindowName, int dwStyle, int x, int y,
- int nWidth, int nHeight, IntPtr hWndParent, IntPtr hMenu, IntPtr hInstance,
- IntPtr lpParam);
-
-
- ///
- /// Processes a default windows procedure.
- ///
- [DllImport("USER32.DLL")]
- public static extern IntPtr DefWindowProc(IntPtr hWnd, uint msg, IntPtr wparam, IntPtr lparam);
-
- ///
- /// Registers the helper window class.
- ///
- [DllImport("USER32.DLL", EntryPoint = "RegisterClassW", SetLastError = true)]
- public static extern short RegisterClass(ref WindowClass lpWndClass);
-
- ///
- /// Registers a listener for a window message.
- ///
- ///
- ///
- [DllImport("User32.Dll", EntryPoint = "RegisterWindowMessageW")]
- public static extern uint RegisterWindowMessage([MarshalAs(UnmanagedType.LPWStr)] string lpString);
-
- ///
- /// Used to destroy the hidden helper window that receives messages from the
- /// taskbar icon.
- ///
- ///
- ///
- [DllImport("USER32.DLL", SetLastError = true)]
- public static extern bool DestroyWindow(IntPtr hWnd);
-
-
- ///
- /// Gives focus to a given window.
- ///
- ///
- ///
- [DllImport("USER32.DLL")]
- public static extern bool SetForegroundWindow(IntPtr hWnd);
-
-
- ///
- /// Gets the maximum number of milliseconds that can elapse between a
- /// first click and a second click for the OS to consider the
- /// mouse action a double-click.
- ///
- /// The maximum amount of time, in milliseconds, that can
- /// elapse between a first click and a second click for the OS to
- /// consider the mouse action a double-click.
- [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
- public static extern int GetDoubleClickTime();
-
-
- ///
- /// Gets the screen coordinates of the current mouse position.
- ///
- [DllImport("USER32.DLL", SetLastError = true)]
- public static extern bool GetPhysicalCursorPos(ref Point lpPoint);
-
-
- [DllImport("USER32.DLL", SetLastError = true)]
- public static extern bool GetCursorPos(ref Point lpPoint);
- }
+using System;
+using System.Runtime.InteropServices;
+
+namespace Hardcodet.Wpf.TaskbarNotification.Interop
+{
+ ///
+ /// Win32 API imports.
+ ///
+ internal static class WinApi
+ {
+ ///
+ /// Creates, updates or deletes the taskbar icon.
+ ///
+ [DllImport("shell32.Dll", CharSet = CharSet.Unicode)]
+ public static extern bool Shell_NotifyIcon(NotifyCommand cmd, [In] ref NotifyIconData data);
+
+
+ ///
+ /// Creates the helper window that receives messages from the taskar icon.
+ ///
+ [DllImport("USER32.DLL", EntryPoint = "CreateWindowExW", SetLastError = true)]
+ public static extern IntPtr CreateWindowEx(int dwExStyle, [MarshalAs(UnmanagedType.LPWStr)] string lpClassName,
+ [MarshalAs(UnmanagedType.LPWStr)] string lpWindowName, int dwStyle, int x, int y,
+ int nWidth, int nHeight, IntPtr hWndParent, IntPtr hMenu, IntPtr hInstance,
+ IntPtr lpParam);
+
+
+ ///
+ /// Processes a default windows procedure.
+ ///
+ [DllImport("USER32.DLL")]
+ public static extern IntPtr DefWindowProc(IntPtr hWnd, uint msg, IntPtr wparam, IntPtr lparam);
+
+ ///
+ /// Registers the helper window class.
+ ///
+ [DllImport("USER32.DLL", EntryPoint = "RegisterClassW", SetLastError = true)]
+ public static extern short RegisterClass(ref WindowClass lpWndClass);
+
+ ///
+ /// Registers a listener for a window message.
+ ///
+ ///
+ ///
+ [DllImport("User32.Dll", EntryPoint = "RegisterWindowMessageW")]
+ public static extern uint RegisterWindowMessage([MarshalAs(UnmanagedType.LPWStr)] string lpString);
+
+ ///
+ /// Used to destroy the hidden helper window that receives messages from the
+ /// taskbar icon.
+ ///
+ ///
+ ///
+ [DllImport("USER32.DLL", SetLastError = true)]
+ public static extern bool DestroyWindow(IntPtr hWnd);
+
+
+ ///
+ /// Gives focus to a given window.
+ ///
+ ///
+ ///
+ [DllImport("USER32.DLL")]
+ public static extern bool SetForegroundWindow(IntPtr hWnd);
+
+
+ ///
+ /// Gets the maximum number of milliseconds that can elapse between a
+ /// first click and a second click for the OS to consider the
+ /// mouse action a double-click.
+ ///
+ /// The maximum amount of time, in milliseconds, that can
+ /// elapse between a first click and a second click for the OS to
+ /// consider the mouse action a double-click.
+ [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
+ public static extern int GetDoubleClickTime();
+
+
+ ///
+ /// Gets the screen coordinates of the current mouse position.
+ ///
+ [DllImport("USER32.DLL", SetLastError = true)]
+ public static extern bool GetPhysicalCursorPos(ref Point lpPoint);
+
+
+ [DllImport("USER32.DLL", SetLastError = true)]
+ public static extern bool GetCursorPos(ref Point lpPoint);
+ }
}
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Interop/WindowClass.cs b/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Interop/WindowClass.cs
index 8757f04..06ccf7e 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Interop/WindowClass.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Interop/WindowClass.cs
@@ -1,35 +1,35 @@
-using System;
-using System.Runtime.InteropServices;
-
-namespace Hardcodet.Wpf.TaskbarNotification.Interop
-{
- ///
- /// Callback delegate which is used by the Windows API to
- /// submit window messages.
- ///
- public delegate IntPtr WindowProcedureHandler(IntPtr hwnd, uint uMsg, IntPtr wparam, IntPtr lparam);
-
-
- ///
- /// Win API WNDCLASS struct - represents a single window.
- /// Used to receive window messages.
- ///
- [StructLayout(LayoutKind.Sequential)]
- public struct WindowClass
- {
- #pragma warning disable 1591
-
- public uint style;
- public WindowProcedureHandler lpfnWndProc;
- public int cbClsExtra;
- public int cbWndExtra;
- public IntPtr hInstance;
- public IntPtr hIcon;
- public IntPtr hCursor;
- public IntPtr hbrBackground;
- [MarshalAs(UnmanagedType.LPWStr)] public string lpszMenuName;
- [MarshalAs(UnmanagedType.LPWStr)] public string lpszClassName;
-
- #pragma warning restore 1591
- }
+using System;
+using System.Runtime.InteropServices;
+
+namespace Hardcodet.Wpf.TaskbarNotification.Interop
+{
+ ///
+ /// Callback delegate which is used by the Windows API to
+ /// submit window messages.
+ ///
+ public delegate IntPtr WindowProcedureHandler(IntPtr hwnd, uint uMsg, IntPtr wparam, IntPtr lparam);
+
+
+ ///
+ /// Win API WNDCLASS struct - represents a single window.
+ /// Used to receive window messages.
+ ///
+ [StructLayout(LayoutKind.Sequential)]
+ public struct WindowClass
+ {
+ #pragma warning disable 1591
+
+ public uint style;
+ public WindowProcedureHandler lpfnWndProc;
+ public int cbClsExtra;
+ public int cbWndExtra;
+ public IntPtr hInstance;
+ public IntPtr hIcon;
+ public IntPtr hCursor;
+ public IntPtr hbrBackground;
+ [MarshalAs(UnmanagedType.LPWStr)] public string lpszMenuName;
+ [MarshalAs(UnmanagedType.LPWStr)] public string lpszClassName;
+
+ #pragma warning restore 1591
+ }
}
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Interop/WindowMessageSink.cs b/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Interop/WindowMessageSink.cs
index fc21af9..8b55f18 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Interop/WindowMessageSink.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Interop/WindowMessageSink.cs
@@ -1,367 +1,367 @@
-// hardcodet.net NotifyIcon for WPF
-// Copyright (c) 2009 - 2013 Philipp Sumi
-// Contact and Information: http://www.hardcodet.net
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the Code Project Open License (CPOL);
-// either version 1.0 of the License, or (at your option) any later
-// version.
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-//
-// THIS COPYRIGHT NOTICE MAY NOT BE REMOVED FROM THIS FILE
-
-
-using System;
-using System.ComponentModel;
-using System.Diagnostics;
-using System.Runtime.InteropServices;
-
-namespace Hardcodet.Wpf.TaskbarNotification.Interop
-{
- ///
- /// Receives messages from the taskbar icon through
- /// window messages of an underlying helper window.
- ///
- public class WindowMessageSink : IDisposable
- {
- #region members
-
- ///
- /// The ID of messages that are received from the the
- /// taskbar icon.
- ///
- public const int CallbackMessageId = 0x400;
-
- ///
- /// The ID of the message that is being received if the
- /// taskbar is (re)started.
- ///
- private uint taskbarRestartMessageId;
-
- ///
- /// Used to track whether a mouse-up event is just
- /// the aftermath of a double-click and therefore needs
- /// to be suppressed.
- ///
- private bool isDoubleClick;
-
- ///
- /// A delegate that processes messages of the hidden
- /// native window that receives window messages. Storing
- /// this reference makes sure we don't loose our reference
- /// to the message window.
- ///
- private WindowProcedureHandler messageHandler;
-
- ///
- /// Window class ID.
- ///
- internal string WindowId { get; private set; }
-
- ///
- /// Handle for the message window.
- ///
- internal IntPtr MessageWindowHandle { get; private set; }
-
- ///
- /// The version of the underlying icon. Defines how
- /// incoming messages are interpreted.
- ///
- public NotifyIconVersion Version { get; set; }
-
- #endregion
-
- #region events
-
- ///
- /// The custom tooltip should be closed or hidden.
- ///
- public event Action ChangeToolTipStateRequest;
-
- ///
- /// Fired in case the user clicked or moved within
- /// the taskbar icon area.
- ///
- public event Action MouseEventReceived;
-
- ///
- /// Fired if a balloon ToolTip was either displayed
- /// or closed (indicated by the boolean flag).
- ///
- public event Action BalloonToolTipChanged;
-
- ///
- /// Fired if the taskbar was created or restarted. Requires the taskbar
- /// icon to be reset.
- ///
- public event Action TaskbarCreated;
-
- #endregion
-
- #region construction
-
- ///
- /// Creates a new message sink that receives message from
- /// a given taskbar icon.
- ///
- ///
- public WindowMessageSink(NotifyIconVersion version)
- {
- Version = version;
- CreateMessageWindow();
- }
-
-
- private WindowMessageSink()
- {
- }
-
-
- ///
- /// Creates a dummy instance that provides an empty
- /// pointer rather than a real window handler.
- /// Used at design time.
- ///
- ///
- internal static WindowMessageSink CreateEmpty()
- {
- return new WindowMessageSink
- {
- MessageWindowHandle = IntPtr.Zero,
- Version = NotifyIconVersion.Vista
- };
- }
-
- #endregion
-
- #region CreateMessageWindow
-
- ///
- /// Creates the helper message window that is used
- /// to receive messages from the taskbar icon.
- ///
- private void CreateMessageWindow()
- {
- //generate a unique ID for the window
- WindowId = "WPFTaskbarIcon_" + DateTime.Now.Ticks;
-
- //register window message handler
- messageHandler = OnWindowMessageReceived;
-
- // Create a simple window class which is reference through
- //the messageHandler delegate
- WindowClass wc;
-
- wc.style = 0;
- wc.lpfnWndProc = messageHandler;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 0;
- wc.hInstance = IntPtr.Zero;
- wc.hIcon = IntPtr.Zero;
- wc.hCursor = IntPtr.Zero;
- wc.hbrBackground = IntPtr.Zero;
- wc.lpszMenuName = "";
- wc.lpszClassName = WindowId;
-
- // Register the window class
- WinApi.RegisterClass(ref wc);
-
- // Get the message used to indicate the taskbar has been restarted
- // This is used to re-add icons when the taskbar restarts
- taskbarRestartMessageId = WinApi.RegisterWindowMessage("TaskbarCreated");
-
- // Create the message window
- MessageWindowHandle = WinApi.CreateWindowEx(0, WindowId, "", 0, 0, 0, 1, 1, IntPtr.Zero, IntPtr.Zero,
- IntPtr.Zero, IntPtr.Zero);
-
- if (MessageWindowHandle == IntPtr.Zero)
- {
-#if SILVERLIGHT
- throw new Exception("Message window handle was not a valid pointer.");
-#else
- throw new Win32Exception("Message window handle was not a valid pointer");
-#endif
- }
- }
-
- #endregion
-
- #region Handle Window Messages
-
- ///
- /// Callback method that receives messages from the taskbar area.
- ///
- private IntPtr OnWindowMessageReceived(IntPtr hwnd, uint messageId, IntPtr wparam, IntPtr lparam)
- {
- if (messageId == taskbarRestartMessageId)
- {
- //recreate the icon if the taskbar was restarted (e.g. due to Win Explorer shutdown)
- TaskbarCreated();
- }
-
- //forward message
- ProcessWindowMessage(messageId, wparam, lparam);
-
- // Pass the message to the default window procedure
- return WinApi.DefWindowProc(hwnd, messageId, wparam, lparam);
- }
-
-
- ///
- /// Processes incoming system messages.
- ///
- /// Callback ID.
- /// If the version is
- /// or higher, this parameter can be used to resolve mouse coordinates.
- /// Currently not in use.
- /// Provides information about the event.
- private void ProcessWindowMessage(uint msg, IntPtr wParam, IntPtr lParam)
- {
- if (msg != CallbackMessageId) return;
-
- switch (lParam.ToInt32())
- {
- case 0x200:
- MouseEventReceived(MouseEvent.MouseMove);
- break;
-
- case 0x201:
- MouseEventReceived(MouseEvent.IconLeftMouseDown);
- break;
-
- case 0x202:
- if (!isDoubleClick)
- {
- MouseEventReceived(MouseEvent.IconLeftMouseUp);
- }
- isDoubleClick = false;
- break;
-
- case 0x203:
- isDoubleClick = true;
- MouseEventReceived(MouseEvent.IconDoubleClick);
- break;
-
- case 0x204:
- MouseEventReceived(MouseEvent.IconRightMouseDown);
- break;
-
- case 0x205:
- MouseEventReceived(MouseEvent.IconRightMouseUp);
- break;
-
- case 0x206:
- //double click with right mouse button - do not trigger event
- break;
-
- case 0x207:
- MouseEventReceived(MouseEvent.IconMiddleMouseDown);
- break;
-
- case 520:
- MouseEventReceived(MouseEvent.IconMiddleMouseUp);
- break;
-
- case 0x209:
- //double click with middle mouse button - do not trigger event
- break;
-
- case 0x402:
- BalloonToolTipChanged(true);
- break;
-
- case 0x403:
- case 0x404:
- BalloonToolTipChanged(false);
- break;
-
- case 0x405:
- MouseEventReceived(MouseEvent.BalloonToolTipClicked);
- break;
-
- case 0x406:
- ChangeToolTipStateRequest(true);
- break;
-
- case 0x407:
- ChangeToolTipStateRequest(false);
- break;
-
- default:
- Debug.WriteLine("Unhandled NotifyIcon message ID: " + lParam);
- break;
- }
- }
-
- #endregion
-
- #region Dispose
-
- ///
- /// Set to true as soon as Dispose has been invoked.
- ///
- public bool IsDisposed { get; private set; }
-
-
- ///
- /// Disposes the object.
- ///
- /// This method is not virtual by design. Derived classes
- /// should override .
- ///
- public void Dispose()
- {
- Dispose(true);
-
- // This object will be cleaned up by the Dispose method.
- // Therefore, you should call GC.SupressFinalize to
- // take this object off the finalization queue
- // and prevent finalization code for this object
- // from executing a second time.
- GC.SuppressFinalize(this);
- }
-
- ///
- /// This destructor will run only if the
- /// method does not get called. This gives this base class the
- /// opportunity to finalize.
- ///
- /// Important: Do not provide destructors in types derived from
- /// this class.
- ///
- ///
- ~WindowMessageSink()
- {
- Dispose(false);
- }
-
-
- ///
- /// Removes the windows hook that receives window
- /// messages and closes the underlying helper window.
- ///
- private void Dispose(bool disposing)
- {
- //don't do anything if the component is already disposed
- if (IsDisposed) return;
- IsDisposed = true;
-
- //always destroy the unmanaged handle (even if called from the GC)
- WinApi.DestroyWindow(MessageWindowHandle);
- messageHandler = null;
- }
-
- #endregion
- }
+// hardcodet.net NotifyIcon for WPF
+// Copyright (c) 2009 - 2013 Philipp Sumi
+// Contact and Information: http://www.hardcodet.net
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the Code Project Open License (CPOL);
+// either version 1.0 of the License, or (at your option) any later
+// version.
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+//
+// THIS COPYRIGHT NOTICE MAY NOT BE REMOVED FROM THIS FILE
+
+
+using System;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Runtime.InteropServices;
+
+namespace Hardcodet.Wpf.TaskbarNotification.Interop
+{
+ ///
+ /// Receives messages from the taskbar icon through
+ /// window messages of an underlying helper window.
+ ///
+ public class WindowMessageSink : IDisposable
+ {
+ #region members
+
+ ///
+ /// The ID of messages that are received from the the
+ /// taskbar icon.
+ ///
+ public const int CallbackMessageId = 0x400;
+
+ ///
+ /// The ID of the message that is being received if the
+ /// taskbar is (re)started.
+ ///
+ private uint taskbarRestartMessageId;
+
+ ///
+ /// Used to track whether a mouse-up event is just
+ /// the aftermath of a double-click and therefore needs
+ /// to be suppressed.
+ ///
+ private bool isDoubleClick;
+
+ ///
+ /// A delegate that processes messages of the hidden
+ /// native window that receives window messages. Storing
+ /// this reference makes sure we don't loose our reference
+ /// to the message window.
+ ///
+ private WindowProcedureHandler messageHandler;
+
+ ///
+ /// Window class ID.
+ ///
+ internal string WindowId { get; private set; }
+
+ ///
+ /// Handle for the message window.
+ ///
+ internal IntPtr MessageWindowHandle { get; private set; }
+
+ ///
+ /// The version of the underlying icon. Defines how
+ /// incoming messages are interpreted.
+ ///
+ public NotifyIconVersion Version { get; set; }
+
+ #endregion
+
+ #region events
+
+ ///
+ /// The custom tooltip should be closed or hidden.
+ ///
+ public event Action ChangeToolTipStateRequest;
+
+ ///
+ /// Fired in case the user clicked or moved within
+ /// the taskbar icon area.
+ ///
+ public event Action MouseEventReceived;
+
+ ///
+ /// Fired if a balloon ToolTip was either displayed
+ /// or closed (indicated by the boolean flag).
+ ///
+ public event Action BalloonToolTipChanged;
+
+ ///
+ /// Fired if the taskbar was created or restarted. Requires the taskbar
+ /// icon to be reset.
+ ///
+ public event Action TaskbarCreated;
+
+ #endregion
+
+ #region construction
+
+ ///
+ /// Creates a new message sink that receives message from
+ /// a given taskbar icon.
+ ///
+ ///
+ public WindowMessageSink(NotifyIconVersion version)
+ {
+ Version = version;
+ CreateMessageWindow();
+ }
+
+
+ private WindowMessageSink()
+ {
+ }
+
+
+ ///
+ /// Creates a dummy instance that provides an empty
+ /// pointer rather than a real window handler.
+ /// Used at design time.
+ ///
+ ///
+ internal static WindowMessageSink CreateEmpty()
+ {
+ return new WindowMessageSink
+ {
+ MessageWindowHandle = IntPtr.Zero,
+ Version = NotifyIconVersion.Vista
+ };
+ }
+
+ #endregion
+
+ #region CreateMessageWindow
+
+ ///
+ /// Creates the helper message window that is used
+ /// to receive messages from the taskbar icon.
+ ///
+ private void CreateMessageWindow()
+ {
+ //generate a unique ID for the window
+ WindowId = "WPFTaskbarIcon_" + DateTime.Now.Ticks;
+
+ //register window message handler
+ messageHandler = OnWindowMessageReceived;
+
+ // Create a simple window class which is reference through
+ //the messageHandler delegate
+ WindowClass wc;
+
+ wc.style = 0;
+ wc.lpfnWndProc = messageHandler;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = 0;
+ wc.hInstance = IntPtr.Zero;
+ wc.hIcon = IntPtr.Zero;
+ wc.hCursor = IntPtr.Zero;
+ wc.hbrBackground = IntPtr.Zero;
+ wc.lpszMenuName = "";
+ wc.lpszClassName = WindowId;
+
+ // Register the window class
+ WinApi.RegisterClass(ref wc);
+
+ // Get the message used to indicate the taskbar has been restarted
+ // This is used to re-add icons when the taskbar restarts
+ taskbarRestartMessageId = WinApi.RegisterWindowMessage("TaskbarCreated");
+
+ // Create the message window
+ MessageWindowHandle = WinApi.CreateWindowEx(0, WindowId, "", 0, 0, 0, 1, 1, IntPtr.Zero, IntPtr.Zero,
+ IntPtr.Zero, IntPtr.Zero);
+
+ if (MessageWindowHandle == IntPtr.Zero)
+ {
+#if SILVERLIGHT
+ throw new Exception("Message window handle was not a valid pointer.");
+#else
+ throw new Win32Exception("Message window handle was not a valid pointer");
+#endif
+ }
+ }
+
+ #endregion
+
+ #region Handle Window Messages
+
+ ///
+ /// Callback method that receives messages from the taskbar area.
+ ///
+ private IntPtr OnWindowMessageReceived(IntPtr hwnd, uint messageId, IntPtr wparam, IntPtr lparam)
+ {
+ if (messageId == taskbarRestartMessageId)
+ {
+ //recreate the icon if the taskbar was restarted (e.g. due to Win Explorer shutdown)
+ TaskbarCreated();
+ }
+
+ //forward message
+ ProcessWindowMessage(messageId, wparam, lparam);
+
+ // Pass the message to the default window procedure
+ return WinApi.DefWindowProc(hwnd, messageId, wparam, lparam);
+ }
+
+
+ ///
+ /// Processes incoming system messages.
+ ///
+ /// Callback ID.
+ /// If the version is
+ /// or higher, this parameter can be used to resolve mouse coordinates.
+ /// Currently not in use.
+ /// Provides information about the event.
+ private void ProcessWindowMessage(uint msg, IntPtr wParam, IntPtr lParam)
+ {
+ if (msg != CallbackMessageId) return;
+
+ switch (lParam.ToInt32())
+ {
+ case 0x200:
+ MouseEventReceived(MouseEvent.MouseMove);
+ break;
+
+ case 0x201:
+ MouseEventReceived(MouseEvent.IconLeftMouseDown);
+ break;
+
+ case 0x202:
+ if (!isDoubleClick)
+ {
+ MouseEventReceived(MouseEvent.IconLeftMouseUp);
+ }
+ isDoubleClick = false;
+ break;
+
+ case 0x203:
+ isDoubleClick = true;
+ MouseEventReceived(MouseEvent.IconDoubleClick);
+ break;
+
+ case 0x204:
+ MouseEventReceived(MouseEvent.IconRightMouseDown);
+ break;
+
+ case 0x205:
+ MouseEventReceived(MouseEvent.IconRightMouseUp);
+ break;
+
+ case 0x206:
+ //double click with right mouse button - do not trigger event
+ break;
+
+ case 0x207:
+ MouseEventReceived(MouseEvent.IconMiddleMouseDown);
+ break;
+
+ case 520:
+ MouseEventReceived(MouseEvent.IconMiddleMouseUp);
+ break;
+
+ case 0x209:
+ //double click with middle mouse button - do not trigger event
+ break;
+
+ case 0x402:
+ BalloonToolTipChanged(true);
+ break;
+
+ case 0x403:
+ case 0x404:
+ BalloonToolTipChanged(false);
+ break;
+
+ case 0x405:
+ MouseEventReceived(MouseEvent.BalloonToolTipClicked);
+ break;
+
+ case 0x406:
+ ChangeToolTipStateRequest(true);
+ break;
+
+ case 0x407:
+ ChangeToolTipStateRequest(false);
+ break;
+
+ default:
+ Debug.WriteLine("Unhandled NotifyIcon message ID: " + lParam);
+ break;
+ }
+ }
+
+ #endregion
+
+ #region Dispose
+
+ ///
+ /// Set to true as soon as Dispose has been invoked.
+ ///
+ public bool IsDisposed { get; private set; }
+
+
+ ///
+ /// Disposes the object.
+ ///
+ /// This method is not virtual by design. Derived classes
+ /// should override .
+ ///
+ public void Dispose()
+ {
+ Dispose(true);
+
+ // This object will be cleaned up by the Dispose method.
+ // Therefore, you should call GC.SupressFinalize to
+ // take this object off the finalization queue
+ // and prevent finalization code for this object
+ // from executing a second time.
+ GC.SuppressFinalize(this);
+ }
+
+ ///
+ /// This destructor will run only if the
+ /// method does not get called. This gives this base class the
+ /// opportunity to finalize.
+ ///
+ /// Important: Do not provide destructors in types derived from
+ /// this class.
+ ///
+ ///
+ ~WindowMessageSink()
+ {
+ Dispose(false);
+ }
+
+
+ ///
+ /// Removes the windows hook that receives window
+ /// messages and closes the underlying helper window.
+ ///
+ private void Dispose(bool disposing)
+ {
+ //don't do anything if the component is already disposed
+ if (IsDisposed) return;
+ IsDisposed = true;
+
+ //always destroy the unmanaged handle (even if called from the GC)
+ WinApi.DestroyWindow(MessageWindowHandle);
+ messageHandler = null;
+ }
+
+ #endregion
+ }
}
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/NotifyIconWpf.csproj b/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/NotifyIconWpf.csproj
index 82c3ecf..981fc5e 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/NotifyIconWpf.csproj
+++ b/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/NotifyIconWpf.csproj
@@ -1,83 +1,83 @@
-
-
-
- Debug
- AnyCPU
- 9.0.30729
- 2.0
- {7AC63864-7638-41C4-969C-D3197EF2BED9}
- library
- Properties
- Hardcodet.Wpf.TaskbarNotification
- Hardcodet.Wpf.TaskbarNotification
- v4.0
- 512
- {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- 4
- Client
-
-
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
- AnyCPU
- AllRules.ruleset
-
-
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
- bin\Release\Hardcodet.Wpf.TaskbarNotification.xml
- AllRules.ruleset
-
-
-
-
-
-
-
-
-
-
-
-
- Code
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Code
-
-
-
-
-
-
-
-
-
+
+
+
+ Debug
+ AnyCPU
+ 9.0.30729
+ 2.0
+ {7AC63864-7638-41C4-969C-D3197EF2BED9}
+ library
+ Properties
+ Hardcodet.Wpf.TaskbarNotification
+ Hardcodet.Wpf.TaskbarNotification
+ v4.0
+ 512
+ {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ 4
+ Client
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+ AnyCPU
+ AllRules.ruleset
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+ bin\Release\Hardcodet.Wpf.TaskbarNotification.xml
+ AllRules.ruleset
+
+
+
+
+
+
+
+
+
+
+
+
+ Code
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Code
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/PopupActivationMode.cs b/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/PopupActivationMode.cs
index 227fb0a..1415f39 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/PopupActivationMode.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/PopupActivationMode.cs
@@ -1,75 +1,75 @@
-// hardcodet.net NotifyIcon for WPF
-// Copyright (c) 2009 - 2013 Philipp Sumi
-// Contact and Information: http://www.hardcodet.net
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the Code Project Open License (CPOL);
-// either version 1.0 of the License, or (at your option) any later
-// version.
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-//
-// THIS COPYRIGHT NOTICE MAY NOT BE REMOVED FROM THIS FILE
-
-
-namespace Hardcodet.Wpf.TaskbarNotification
-{
- ///
- /// Defines flags that define when a popup
- /// is being displyed.
- ///
- public enum PopupActivationMode
- {
- ///
- /// The item is displayed if the user clicks the
- /// tray icon with the left mouse button.
- ///
- LeftClick,
-
- ///
- /// The item is displayed if the user clicks the
- /// tray icon with the right mouse button.
- ///
- RightClick,
-
- ///
- /// The item is displayed if the user double-clicks the
- /// tray icon.
- ///
- DoubleClick,
-
- ///
- /// The item is displayed if the user clicks the
- /// tray icon with the left or the right mouse button.
- ///
- LeftOrRightClick,
-
- ///
- /// The item is displayed if the user clicks the
- /// tray icon with the left mouse button or if a
- /// double-click is being performed.
- ///
- LeftOrDoubleClick,
-
- ///
- /// The item is displayed if the user clicks the
- /// tray icon with the middle mouse button.
- ///
- MiddleClick,
-
- ///
- /// The item is displayed whenever a click occurs.
- ///
- All
- }
+// hardcodet.net NotifyIcon for WPF
+// Copyright (c) 2009 - 2013 Philipp Sumi
+// Contact and Information: http://www.hardcodet.net
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the Code Project Open License (CPOL);
+// either version 1.0 of the License, or (at your option) any later
+// version.
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+//
+// THIS COPYRIGHT NOTICE MAY NOT BE REMOVED FROM THIS FILE
+
+
+namespace Hardcodet.Wpf.TaskbarNotification
+{
+ ///
+ /// Defines flags that define when a popup
+ /// is being displyed.
+ ///
+ public enum PopupActivationMode
+ {
+ ///
+ /// The item is displayed if the user clicks the
+ /// tray icon with the left mouse button.
+ ///
+ LeftClick,
+
+ ///
+ /// The item is displayed if the user clicks the
+ /// tray icon with the right mouse button.
+ ///
+ RightClick,
+
+ ///
+ /// The item is displayed if the user double-clicks the
+ /// tray icon.
+ ///
+ DoubleClick,
+
+ ///
+ /// The item is displayed if the user clicks the
+ /// tray icon with the left or the right mouse button.
+ ///
+ LeftOrRightClick,
+
+ ///
+ /// The item is displayed if the user clicks the
+ /// tray icon with the left mouse button or if a
+ /// double-click is being performed.
+ ///
+ LeftOrDoubleClick,
+
+ ///
+ /// The item is displayed if the user clicks the
+ /// tray icon with the middle mouse button.
+ ///
+ MiddleClick,
+
+ ///
+ /// The item is displayed whenever a click occurs.
+ ///
+ All
+ }
}
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Properties/AssemblyInfo.cs b/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Properties/AssemblyInfo.cs
index 12f8fda..49d0d2e 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Properties/AssemblyInfo.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Properties/AssemblyInfo.cs
@@ -1,64 +1,64 @@
-using System;
-using System.Reflection;
-using System.Runtime.InteropServices;
-using System.Windows;
-using System.Windows.Markup;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-
-[assembly: AssemblyTitle("NotifyIcon for WPF")]
-[assembly: AssemblyDescription("NotifyIcon implementation for the WPF platform.")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("hardcodet.net")]
-[assembly: AssemblyProduct("NotifyIcon WPF")]
-[assembly: AssemblyCopyright("Copyright © Philipp Sumi 2013")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-
-[assembly: AssemblyVersion("1.0.5.0")]
-[assembly: AssemblyFileVersion("1.0.5.0")]
-
-
-//provides simplified declaration in XAML
-[assembly: XmlnsPrefix("http://www.hardcodet.net/taskbar", "tb")]
-[assembly: XmlnsDefinition("http://www.hardcodet.net/taskbar", "Hardcodet.Wpf.TaskbarNotification")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-
-[assembly: ComVisible(false)]
-
-//In order to begin building localizable applications, set
-//CultureYouAreCodingWith in your .csproj file
-//inside a . For example, if you are using US english
-//in your source files, set the to en-US. Then uncomment
-//the NeutralResourceLanguage attribute below. Update the "en-US" in
-//the line below to match the UICulture setting in the project file.
-
-//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
-
-[assembly: ThemeInfo(
- ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
- //(used if a resource is not found in the page,
- // or application resource dictionaries)
- ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
- //(used if a resource is not found in the page,
- // app, or any theme specific resource dictionaries)
- )]
-
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-
+using System;
+using System.Reflection;
+using System.Runtime.InteropServices;
+using System.Windows;
+using System.Windows.Markup;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+
+[assembly: AssemblyTitle("NotifyIcon for WPF")]
+[assembly: AssemblyDescription("NotifyIcon implementation for the WPF platform.")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("hardcodet.net")]
+[assembly: AssemblyProduct("NotifyIcon WPF")]
+[assembly: AssemblyCopyright("Copyright © Philipp Sumi 2013")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+
+[assembly: AssemblyVersion("1.0.5.0")]
+[assembly: AssemblyFileVersion("1.0.5.0")]
+
+
+//provides simplified declaration in XAML
+[assembly: XmlnsPrefix("http://www.hardcodet.net/taskbar", "tb")]
+[assembly: XmlnsDefinition("http://www.hardcodet.net/taskbar", "Hardcodet.Wpf.TaskbarNotification")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+
+[assembly: ComVisible(false)]
+
+//In order to begin building localizable applications, set
+//CultureYouAreCodingWith in your .csproj file
+//inside a . For example, if you are using US english
+//in your source files, set the to en-US. Then uncomment
+//the NeutralResourceLanguage attribute below. Update the "en-US" in
+//the line below to match the UICulture setting in the project file.
+
+//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
+
+[assembly: ThemeInfo(
+ ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
+ //(used if a resource is not found in the page,
+ // or application resource dictionaries)
+ ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
+ //(used if a resource is not found in the page,
+ // app, or any theme specific resource dictionaries)
+ )]
+
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/RoutedEventHelper.cs b/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/RoutedEventHelper.cs
index 89bc299..2e3004a 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/RoutedEventHelper.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/RoutedEventHelper.cs
@@ -1,81 +1,81 @@
-using System;
-using System.Windows;
-
-namespace Hardcodet.Wpf.TaskbarNotification
-{
- ///
- /// Helper class used by routed events of the
- /// class.
- ///
- internal static class RoutedEventHelper
- {
- #region RoutedEvent Helper Methods
-
- ///
- /// A static helper method to raise a routed event on a target UIElement or ContentElement.
- ///
- /// UIElement or ContentElement on which to raise the event
- /// RoutedEventArgs to use when raising the event
- internal static void RaiseEvent(DependencyObject target, RoutedEventArgs args)
- {
- if (target is UIElement)
- {
- (target as UIElement).RaiseEvent(args);
- }
- else if (target is ContentElement)
- {
- (target as ContentElement).RaiseEvent(args);
- }
- }
-
- ///
- /// A static helper method that adds a handler for a routed event
- /// to a target UIElement or ContentElement.
- ///
- /// UIElement or ContentElement that listens to the event
- /// Event that will be handled
- /// Event handler to be added
- internal static void AddHandler(DependencyObject element, RoutedEvent routedEvent, Delegate handler)
- {
- UIElement uie = element as UIElement;
- if (uie != null)
- {
- uie.AddHandler(routedEvent, handler);
- }
- else
- {
- ContentElement ce = element as ContentElement;
- if (ce != null)
- {
- ce.AddHandler(routedEvent, handler);
- }
- }
- }
-
- ///
- /// A static helper method that removes a handler for a routed event
- /// from a target UIElement or ContentElement.
- ///
- /// UIElement or ContentElement that listens to the event
- /// Event that will no longer be handled
- /// Event handler to be removed
- internal static void RemoveHandler(DependencyObject element, RoutedEvent routedEvent, Delegate handler)
- {
- UIElement uie = element as UIElement;
- if (uie != null)
- {
- uie.RemoveHandler(routedEvent, handler);
- }
- else
- {
- ContentElement ce = element as ContentElement;
- if (ce != null)
- {
- ce.RemoveHandler(routedEvent, handler);
- }
- }
- }
-
- #endregion
- }
+using System;
+using System.Windows;
+
+namespace Hardcodet.Wpf.TaskbarNotification
+{
+ ///
+ /// Helper class used by routed events of the
+ /// class.
+ ///
+ internal static class RoutedEventHelper
+ {
+ #region RoutedEvent Helper Methods
+
+ ///
+ /// A static helper method to raise a routed event on a target UIElement or ContentElement.
+ ///
+ /// UIElement or ContentElement on which to raise the event
+ /// RoutedEventArgs to use when raising the event
+ internal static void RaiseEvent(DependencyObject target, RoutedEventArgs args)
+ {
+ if (target is UIElement)
+ {
+ (target as UIElement).RaiseEvent(args);
+ }
+ else if (target is ContentElement)
+ {
+ (target as ContentElement).RaiseEvent(args);
+ }
+ }
+
+ ///
+ /// A static helper method that adds a handler for a routed event
+ /// to a target UIElement or ContentElement.
+ ///
+ /// UIElement or ContentElement that listens to the event
+ /// Event that will be handled
+ /// Event handler to be added
+ internal static void AddHandler(DependencyObject element, RoutedEvent routedEvent, Delegate handler)
+ {
+ UIElement uie = element as UIElement;
+ if (uie != null)
+ {
+ uie.AddHandler(routedEvent, handler);
+ }
+ else
+ {
+ ContentElement ce = element as ContentElement;
+ if (ce != null)
+ {
+ ce.AddHandler(routedEvent, handler);
+ }
+ }
+ }
+
+ ///
+ /// A static helper method that removes a handler for a routed event
+ /// from a target UIElement or ContentElement.
+ ///
+ /// UIElement or ContentElement that listens to the event
+ /// Event that will no longer be handled
+ /// Event handler to be removed
+ internal static void RemoveHandler(DependencyObject element, RoutedEvent routedEvent, Delegate handler)
+ {
+ UIElement uie = element as UIElement;
+ if (uie != null)
+ {
+ uie.RemoveHandler(routedEvent, handler);
+ }
+ else
+ {
+ ContentElement ce = element as ContentElement;
+ if (ce != null)
+ {
+ ce.RemoveHandler(routedEvent, handler);
+ }
+ }
+ }
+
+ #endregion
+ }
}
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/TaskbarIcon.Declarations.cs b/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/TaskbarIcon.Declarations.cs
index b0e4bb7..a12c56e 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/TaskbarIcon.Declarations.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/TaskbarIcon.Declarations.cs
@@ -1,1891 +1,1891 @@
-// hardcodet.net NotifyIcon for WPF
-// Copyright (c) 2009 - 2013 Philipp Sumi
-// Contact and Information: http://www.hardcodet.net
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the Code Project Open License (CPOL);
-// either version 1.0 of the License, or (at your option) any later
-// version.
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-//
-// THIS COPYRIGHT NOTICE MAY NOT BE REMOVED FROM THIS FILE
-
-
-using System;
-using System.ComponentModel;
-using System.Drawing;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Controls.Primitives;
-using System.Windows.Input;
-using System.Windows.Media;
-using Hardcodet.Wpf.TaskbarNotification.Interop;
-
-namespace Hardcodet.Wpf.TaskbarNotification
-{
- ///
- /// Contains declarations of WPF dependency properties
- /// and events.
- ///
- partial class TaskbarIcon
- {
- ///
- /// Category name that is set on designer properties.
- ///
- public const string CategoryName = "NotifyIcon";
-
-
- //POPUP CONTROLS
-
- #region TrayPopupResolved
-
- ///
- /// TrayPopupResolved Read-Only Dependency Property
- ///
- private static readonly DependencyPropertyKey TrayPopupResolvedPropertyKey
- = DependencyProperty.RegisterReadOnly("TrayPopupResolved", typeof (Popup), typeof (TaskbarIcon),
- new FrameworkPropertyMetadata(null));
-
-
- ///
- /// A read-only dependency property that returns the
- /// that is being displayed in the taskbar area based on a user action.
- ///
- public static readonly DependencyProperty TrayPopupResolvedProperty
- = TrayPopupResolvedPropertyKey.DependencyProperty;
-
- ///
- /// Gets the TrayPopupResolved property. Returns
- /// a which is either the
- /// control itself or a
- /// control that contains the
- /// .
- ///
- [Category(CategoryName)]
- public Popup TrayPopupResolved
- {
- get { return (Popup) GetValue(TrayPopupResolvedProperty); }
- }
-
- ///
- /// Provides a secure method for setting the TrayPopupResolved property.
- /// This dependency property indicates ....
- ///
- /// The new value for the property.
- protected void SetTrayPopupResolved(Popup value)
- {
- SetValue(TrayPopupResolvedPropertyKey, value);
- }
-
- #endregion
-
- #region TrayToolTipResolved
-
- ///
- /// TrayToolTipResolved Read-Only Dependency Property
- ///
- private static readonly DependencyPropertyKey TrayToolTipResolvedPropertyKey
- = DependencyProperty.RegisterReadOnly("TrayToolTipResolved", typeof (ToolTip), typeof (TaskbarIcon),
- new FrameworkPropertyMetadata(null));
-
-
- ///
- /// A read-only dependency property that returns the
- /// that is being displayed.
- ///
- public static readonly DependencyProperty TrayToolTipResolvedProperty
- = TrayToolTipResolvedPropertyKey.DependencyProperty;
-
- ///
- /// Gets the TrayToolTipResolved property. Returns
- /// a control that was created
- /// in order to display either
- /// or .
- ///
- [Category(CategoryName)]
- [Browsable(true)]
- [Bindable(true)]
- public ToolTip TrayToolTipResolved
- {
- get { return (ToolTip) GetValue(TrayToolTipResolvedProperty); }
- }
-
- ///
- /// Provides a secure method for setting the
- /// property.
- ///
- /// The new value for the property.
- protected void SetTrayToolTipResolved(ToolTip 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));
-
- ///
- /// Maintains a currently displayed custom balloon.
- ///
- 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 property.
- ///
- /// The new value for the property.
- protected void SetCustomBalloon(Popup value)
- {
- SetValue(CustomBalloonPropertyKey, value);
- }
-
- #endregion
-
- //DEPENDENCY PROPERTIES
-
- #region Icon property / IconSource dependency property
-
- private Icon icon;
-
- ///
- /// Gets or sets the icon to be displayed. This is not a
- /// dependency property - if you want to assign the property
- /// through XAML, please use the
- /// dependency property.
- ///
- [Browsable(false)]
- public Icon Icon
- {
- get { return icon; }
- set
- {
- icon = value;
- iconData.IconHandle = value == null ? IntPtr.Zero : icon.Handle;
-
- Util.WriteIconData(ref iconData, NotifyCommand.Modify, IconDataMembers.Icon);
- }
- }
-
-
- ///
- /// Resolves an image source and updates the property accordingly.
- ///
- public static readonly DependencyProperty IconSourceProperty =
- DependencyProperty.Register("IconSource",
- typeof (ImageSource),
- typeof (TaskbarIcon),
- new FrameworkPropertyMetadata(null, IconSourcePropertyChanged));
-
- ///
- /// A property wrapper for the
- /// dependency property:
- /// Resolves an image source and updates the property accordingly.
- ///
- [Category(CategoryName)]
- [Description("Sets the displayed taskbar icon.")]
- public ImageSource IconSource
- {
- get { return (ImageSource) GetValue(IconSourceProperty); }
- set { SetValue(IconSourceProperty, value); }
- }
-
-
- ///
- /// A static callback listener which is being invoked if 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 IconSourcePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- TaskbarIcon owner = (TaskbarIcon) d;
- owner.OnIconSourcePropertyChanged(e);
- }
-
-
- ///
- /// 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
- /// should be handled here.
- ///
- /// Provides information about the updated property.
- private void OnIconSourcePropertyChanged(DependencyPropertyChangedEventArgs e)
- {
- ImageSource newValue = (ImageSource) e.NewValue;
-
- //resolving the ImageSource at design time is unlikely to work
- if (!Util.IsDesignMode) Icon = newValue.ToIcon();
- }
-
- #endregion
-
- #region ToolTipText dependency property
-
- ///
- /// A tooltip text that is being displayed if no custom
- /// was set or if custom tooltips are not supported.
- ///
- public static readonly DependencyProperty ToolTipTextProperty =
- DependencyProperty.Register("ToolTipText",
- typeof (string),
- typeof (TaskbarIcon),
- new FrameworkPropertyMetadata(String.Empty, ToolTipTextPropertyChanged));
-
-
- ///
- /// A property wrapper for the
- /// dependency property:
- /// A tooltip text that is being displayed if no custom
- /// was set or if custom tooltips are not supported.
- ///
- [Category(CategoryName)]
- [Description("Alternative to a fully blown ToolTip, which is only displayed on Vista and above.")]
- public string ToolTipText
- {
- get { return (string) GetValue(ToolTipTextProperty); }
- set { SetValue(ToolTipTextProperty, value); }
- }
-
-
- ///
- /// A static callback listener which is being invoked if 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 ToolTipTextPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- TaskbarIcon owner = (TaskbarIcon) d;
- owner.OnToolTipTextPropertyChanged(e);
- }
-
-
- ///
- /// 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
- /// should be handled here.
- ///
- /// Provides information about the updated property.
- private void OnToolTipTextPropertyChanged(DependencyPropertyChangedEventArgs e)
- {
- //do not touch tooltips if we have a custom tooltip element
- if (TrayToolTip == null)
- {
- ToolTip currentToolTip = TrayToolTipResolved;
- if (currentToolTip == null)
- {
- //if we don't have a wrapper tooltip for the tooltip text, create it now
- CreateCustomToolTip();
- }
- else
- {
- //if we have a wrapper tooltip that shows the old tooltip text, just update content
- currentToolTip.Content = e.NewValue;
- }
- }
-
- WriteToolTipSettings();
- }
-
- #endregion
-
- #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 TrayToolTipProperty =
- DependencyProperty.Register("TrayToolTip",
- typeof (UIElement),
- typeof (TaskbarIcon),
- new FrameworkPropertyMetadata(null, TrayToolTipPropertyChanged));
-
- ///
- /// 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
- /// the property is set as well.
- ///
- [Category(CategoryName)]
- [Description("Custom UI element that is displayed as a tooltip. Only on Vista and above")]
- public UIElement TrayToolTip
- {
- 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
- /// instance method of the changed instance.
- ///
- /// The currently processed owner of the property.
- /// Provides information about the updated property.
- private static void TrayToolTipPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- TaskbarIcon owner = (TaskbarIcon) d;
- owner.OnTrayToolTipPropertyChanged(e);
- }
-
-
- ///
- /// 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
- /// should be handled here.
- ///
- /// Provides information about the updated property.
- private void OnTrayToolTipPropertyChanged(DependencyPropertyChangedEventArgs e)
- {
- //recreate tooltip control
- CreateCustomToolTip();
-
- if (e.OldValue != null)
- {
- //remove the taskbar icon reference from the previously used element
- SetParentTaskbarIcon((DependencyObject) e.OldValue, null);
- }
-
- if (e.NewValue != null)
- {
- //set this taskbar icon as a reference to the new tooltip element
- SetParentTaskbarIcon((DependencyObject) e.NewValue, this);
- }
-
- //update tooltip settings - needed to make sure a string is set, even
- //if the ToolTipText property is not set. Otherwise, the event that
- //triggers tooltip display is never fired.
- WriteToolTipSettings();
- }
-
- #endregion
-
- #region TrayPopup dependency property
-
- ///
- /// A control that is displayed as a popup when the taskbar icon is clicked.
- ///
- public static readonly DependencyProperty TrayPopupProperty =
- DependencyProperty.Register("TrayPopup",
- typeof (UIElement),
- typeof (TaskbarIcon),
- new FrameworkPropertyMetadata(null, TrayPopupPropertyChanged));
-
- ///
- /// 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 TrayPopup
- {
- 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
- /// instance method of the changed instance.
- ///
- /// The currently processed owner of the property.
- /// Provides information about the updated property.
- private static void TrayPopupPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- TaskbarIcon owner = (TaskbarIcon) d;
- owner.OnTrayPopupPropertyChanged(e);
- }
-
-
- ///
- /// 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
- /// should be handled here.
- ///
- /// Provides information about the updated property.
- private void OnTrayPopupPropertyChanged(DependencyPropertyChangedEventArgs e)
- {
- if (e.OldValue != null)
- {
- //remove the taskbar icon reference from the previously used element
- SetParentTaskbarIcon((DependencyObject) e.OldValue, null);
- }
-
-
- if (e.NewValue != null)
- {
- //set this taskbar icon as a reference to the new tooltip element
- SetParentTaskbarIcon((DependencyObject) e.NewValue, this);
- }
-
- //create a pop
- CreatePopup();
- }
-
- #endregion
-
- #region MenuActivation dependency property
-
- ///
- /// Defines what mouse events display the context menu.
- /// Defaults to .
- ///
- public static readonly DependencyProperty MenuActivationProperty =
- DependencyProperty.Register("MenuActivation",
- typeof (PopupActivationMode),
- typeof (TaskbarIcon),
- new FrameworkPropertyMetadata(PopupActivationMode.RightClick));
-
- ///
- /// A property wrapper for the
- /// dependency property:
- /// Defines what mouse events display the context menu.
- /// Defaults to .
- ///
- [Category(CategoryName)]
- [Description("Defines what mouse events display the context menu.")]
- public PopupActivationMode MenuActivation
- {
- get { return (PopupActivationMode) GetValue(MenuActivationProperty); }
- set { SetValue(MenuActivationProperty, value); }
- }
-
- #endregion
-
- #region PopupActivation dependency property
-
- ///
- /// Defines what mouse events trigger the .
- /// Default is .
- ///
- public static readonly DependencyProperty PopupActivationProperty =
- DependencyProperty.Register("PopupActivation",
- typeof (PopupActivationMode),
- typeof (TaskbarIcon),
- new FrameworkPropertyMetadata(PopupActivationMode.LeftClick));
-
- ///
- /// A property wrapper for the
- /// dependency property:
- /// Defines what mouse events trigger the .
- /// Default is .
- ///
- [Category(CategoryName)]
- [Description("Defines what mouse events display the TaskbarIconPopup.")]
- public PopupActivationMode PopupActivation
- {
- get { return (PopupActivationMode) GetValue(PopupActivationProperty); }
- set { SetValue(PopupActivationProperty, value); }
- }
-
- #endregion
-
- #region Visibility dependency property override
-
- ///
- /// A static callback listener which is being invoked if 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 VisibilityPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- TaskbarIcon owner = (TaskbarIcon) d;
- owner.OnVisibilityPropertyChanged(e);
- }
-
-
- ///
- /// 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
- /// should be handled here.
- ///
- /// Provides information about the updated property.
- private void OnVisibilityPropertyChanged(DependencyPropertyChangedEventArgs e)
- {
- Visibility newValue = (Visibility) e.NewValue;
-
- //update
- if (newValue == Visibility.Visible)
- {
- CreateTaskbarIcon();
- }
- else
- {
- RemoveTaskbarIcon();
- }
- }
-
- #endregion
-
- #region DataContext dependency property override / target update
-
- ///
- /// Updates the of a given
- /// . This method only updates target elements
- /// that do not already have a data context of their own, and either assigns
- /// the of the NotifyIcon, or the
- /// NotifyIcon itself, if no data context was assigned at all.
- ///
- private void UpdateDataContext(FrameworkElement target, object oldDataContextValue, object newDataContextValue)
- {
- //if there is no target or it's data context is determined through a binding
- //of its own, keep it
- if (target == null || target.IsDataContextDataBound()) return;
-
- //if the target's data context is the NotifyIcon's old DataContext or the NotifyIcon itself,
- //update it
- if (ReferenceEquals(this, target.DataContext) || Equals(oldDataContextValue, target.DataContext))
- {
- //assign own data context, if available. If there is no data
- //context at all, assign NotifyIcon itself.
- target.DataContext = newDataContextValue ?? this;
- }
- }
-
- ///
- /// A static callback listener which is being invoked if 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 DataContextPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- TaskbarIcon owner = (TaskbarIcon) d;
- owner.OnDataContextPropertyChanged(e);
- }
-
-
- ///
- /// 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
- /// should be handled here.
- ///
- /// Provides information about the updated property.
- private void OnDataContextPropertyChanged(DependencyPropertyChangedEventArgs e)
- {
- object newValue = e.NewValue;
- object oldValue = e.OldValue;
-
- //replace custom data context for ToolTips, Popup, and
- //ContextMenu
- UpdateDataContext(TrayPopupResolved, oldValue, newValue);
- UpdateDataContext(TrayToolTipResolved, oldValue, newValue);
- UpdateDataContext(ContextMenu, oldValue, newValue);
- }
-
- #endregion
-
- #region ContextMenu dependency property override
-
- ///
- /// A static callback listener which is being invoked if 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 ContextMenuPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- TaskbarIcon owner = (TaskbarIcon) d;
- owner.OnContextMenuPropertyChanged(e);
- }
-
-
- ///
- /// Releases the old and updates the new property
- /// in order to reflect both the NotifyIcon's
- /// property and have the assigned.
- ///
- /// Provides information about the updated property.
- private void OnContextMenuPropertyChanged(DependencyPropertyChangedEventArgs e)
- {
- if (e.OldValue != null)
- {
- //remove the taskbar icon reference from the previously used element
- SetParentTaskbarIcon((DependencyObject) e.OldValue, null);
- }
-
- if (e.NewValue != null)
- {
- //set this taskbar icon as a reference to the new tooltip element
- SetParentTaskbarIcon((DependencyObject) e.NewValue, this);
- }
-
- UpdateDataContext((ContextMenu) e.NewValue, null, DataContext);
- }
-
- #endregion
-
- #region DoubleClickCommand dependency property
-
- ///
- /// Associates a command that is being executed if the tray icon is being
- /// double clicked.
- ///
- public static readonly DependencyProperty DoubleClickCommandProperty =
- DependencyProperty.Register("DoubleClickCommand",
- typeof (ICommand),
- typeof (TaskbarIcon),
- new FrameworkPropertyMetadata(null));
-
- ///
- /// A property wrapper for the
- /// dependency property:
- /// Associates a command that is being executed if the tray icon is being
- /// double clicked.
- ///
- [Category(CategoryName)]
- [Description("A command that is being executed if the tray icon is being double-clicked.")]
- public ICommand DoubleClickCommand
- {
- get { return (ICommand) GetValue(DoubleClickCommandProperty); }
- set { SetValue(DoubleClickCommandProperty, value); }
- }
-
- #endregion
-
- #region DoubleClickCommandParameter dependency property
-
- ///
- /// Command parameter for the .
- ///
- public static readonly DependencyProperty DoubleClickCommandParameterProperty =
- DependencyProperty.Register("DoubleClickCommandParameter",
- typeof (object),
- typeof (TaskbarIcon),
- new FrameworkPropertyMetadata(null));
-
- ///
- /// A property wrapper for the
- /// dependency property:
- /// Command parameter for the .
- ///
- [Category(CategoryName)]
- [Description("Parameter to submit to the DoubleClickCommand when the user double clicks on the NotifyIcon.")]
- public object DoubleClickCommandParameter
- {
- get { return GetValue(DoubleClickCommandParameterProperty); }
- set { SetValue(DoubleClickCommandParameterProperty, value); }
- }
-
- #endregion
-
- #region DoubleClickCommandTarget dependency property
-
- ///
- /// The target of the command that is fired if the notify icon is double clicked.
- ///
- public static readonly DependencyProperty DoubleClickCommandTargetProperty =
- DependencyProperty.Register("DoubleClickCommandTarget",
- typeof (IInputElement),
- typeof (TaskbarIcon),
- new FrameworkPropertyMetadata(null));
-
- ///
- /// A property wrapper for the
- /// dependency property:
- /// The target of the command that is fired if the notify icon is double clicked.
- ///
- [Category(CategoryName)]
- [Description("The target of the command that is fired if the notify icon is double clicked.")]
- public IInputElement DoubleClickCommandTarget
- {
- get { return (IInputElement) GetValue(DoubleClickCommandTargetProperty); }
- set { SetValue(DoubleClickCommandTargetProperty, value); }
- }
-
- #endregion
-
- #region LeftClickCommand dependency property
-
- ///
- /// Associates a command that is being executed if the tray icon is being
- /// double clicked.
- ///
- public static readonly DependencyProperty LeftClickCommandProperty =
- DependencyProperty.Register("LeftClickCommand",
- typeof (ICommand),
- typeof (TaskbarIcon),
- new FrameworkPropertyMetadata(null));
-
- ///
- /// A property wrapper for the
- /// dependency property:
- /// Associates a command that is being executed if the tray icon is being
- /// left-clicked.
- ///
- [Category(CategoryName)]
- [Description("A command that is being executed if the tray icon is being left-clicked.")]
- public ICommand LeftClickCommand
- {
- get { return (ICommand) GetValue(LeftClickCommandProperty); }
- set { SetValue(LeftClickCommandProperty, value); }
- }
-
- #endregion
-
- #region LeftClickCommandParameter dependency property
-
- ///
- /// Command parameter for the .
- ///
- public static readonly DependencyProperty LeftClickCommandParameterProperty =
- DependencyProperty.Register("LeftClickCommandParameter",
- typeof (object),
- typeof (TaskbarIcon),
- new FrameworkPropertyMetadata(null));
-
- ///
- /// A property wrapper for the
- /// dependency property:
- /// Command parameter for the .
- ///
- [Category(CategoryName)]
- [Description("The target of the command that is fired if the notify icon is clicked with the left mouse button."
- )]
- public object LeftClickCommandParameter
- {
- get { return GetValue(LeftClickCommandParameterProperty); }
- set { SetValue(LeftClickCommandParameterProperty, value); }
- }
-
- #endregion
-
- #region LeftClickCommandTarget dependency property
-
- ///
- /// The target of the command that is fired if the notify icon is clicked.
- ///
- public static readonly DependencyProperty LeftClickCommandTargetProperty =
- DependencyProperty.Register("LeftClickCommandTarget",
- typeof (IInputElement),
- typeof (TaskbarIcon),
- new FrameworkPropertyMetadata(null));
-
- ///
- /// A property wrapper for the
- /// dependency property:
- /// The target of the command that is fired if the notify icon is clicked.
- ///
- [Category(CategoryName)]
- [Description("The target of the command that is fired if the notify icon is clicked with the left mouse button."
- )]
- public IInputElement LeftClickCommandTarget
- {
- get { return (IInputElement) GetValue(LeftClickCommandTargetProperty); }
- set { SetValue(LeftClickCommandTargetProperty, value); }
- }
-
- #endregion
-
- //EVENTS
-
- #region TrayLeftMouseDown
-
- ///
- /// TrayLeftMouseDown Routed Event
- ///
- 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 TrayLeftMouseDown
- {
- add { AddHandler(TrayLeftMouseDownEvent, value); }
- remove { RemoveHandler(TrayLeftMouseDownEvent, value); }
- }
-
- ///
- /// A helper method to raise the TrayLeftMouseDown event.
- ///
- protected RoutedEventArgs RaiseTrayLeftMouseDownEvent()
- {
- RoutedEventArgs args = RaiseTrayLeftMouseDownEvent(this);
- return args;
- }
-
- ///
- /// 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 RaiseTrayLeftMouseDownEvent(DependencyObject target)
- {
- if (target == null) return null;
-
- RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = TrayLeftMouseDownEvent;
- RoutedEventHelper.RaiseEvent(target, args);
- return args;
- }
-
- #endregion
-
- #region TrayRightMouseDown
-
- ///
- /// TrayRightMouseDown Routed Event
- ///
- 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 TrayRightMouseDown
- {
- add { AddHandler(TrayRightMouseDownEvent, value); }
- remove { RemoveHandler(TrayRightMouseDownEvent, value); }
- }
-
- ///
- /// A helper method to raise the TrayRightMouseDown event.
- ///
- protected RoutedEventArgs RaiseTrayRightMouseDownEvent()
- {
- return RaiseTrayRightMouseDownEvent(this);
- }
-
- ///
- /// 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 RaiseTrayRightMouseDownEvent(DependencyObject target)
- {
- if (target == null) return null;
-
- RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = TrayRightMouseDownEvent;
- RoutedEventHelper.RaiseEvent(target, args);
- return args;
- }
-
- #endregion
-
- #region TrayMiddleMouseDown
-
- ///
- /// TrayMiddleMouseDown Routed Event
- ///
- 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 TrayMiddleMouseDown
- {
- add { AddHandler(TrayMiddleMouseDownEvent, value); }
- remove { RemoveHandler(TrayMiddleMouseDownEvent, value); }
- }
-
- ///
- /// A helper method to raise the TrayMiddleMouseDown event.
- ///
- protected RoutedEventArgs RaiseTrayMiddleMouseDownEvent()
- {
- return RaiseTrayMiddleMouseDownEvent(this);
- }
-
- ///
- /// 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 RaiseTrayMiddleMouseDownEvent(DependencyObject target)
- {
- if (target == null) return null;
-
- RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = TrayMiddleMouseDownEvent;
- RoutedEventHelper.RaiseEvent(target, args);
- return args;
- }
-
- #endregion
-
- #region TrayLeftMouseUp
-
- ///
- /// TrayLeftMouseUp Routed Event
- ///
- 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 TrayLeftMouseUp
- {
- add { AddHandler(TrayLeftMouseUpEvent, value); }
- remove { RemoveHandler(TrayLeftMouseUpEvent, value); }
- }
-
- ///
- /// A helper method to raise the TrayLeftMouseUp event.
- ///
- protected RoutedEventArgs RaiseTrayLeftMouseUpEvent()
- {
- return RaiseTrayLeftMouseUpEvent(this);
- }
-
- ///
- /// 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 RaiseTrayLeftMouseUpEvent(DependencyObject target)
- {
- if (target == null) return null;
-
- RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = TrayLeftMouseUpEvent;
- RoutedEventHelper.RaiseEvent(target, args);
- return args;
- }
-
- #endregion
-
- #region TrayRightMouseUp
-
- ///
- /// TrayRightMouseUp Routed Event
- ///
- 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 TrayRightMouseUp
- {
- add { AddHandler(TrayRightMouseUpEvent, value); }
- remove { RemoveHandler(TrayRightMouseUpEvent, value); }
- }
-
- ///
- /// A helper method to raise the TrayRightMouseUp event.
- ///
- protected RoutedEventArgs RaiseTrayRightMouseUpEvent()
- {
- return RaiseTrayRightMouseUpEvent(this);
- }
-
- ///
- /// 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 RaiseTrayRightMouseUpEvent(DependencyObject target)
- {
- if (target == null) return null;
-
- RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = TrayRightMouseUpEvent;
- RoutedEventHelper.RaiseEvent(target, args);
- return args;
- }
-
- #endregion
-
- #region TrayMiddleMouseUp
-
- ///
- /// TrayMiddleMouseUp Routed Event
- ///
- 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 TrayMiddleMouseUp
- {
- add { AddHandler(TrayMiddleMouseUpEvent, value); }
- remove { RemoveHandler(TrayMiddleMouseUpEvent, value); }
- }
-
- ///
- /// A helper method to raise the TrayMiddleMouseUp event.
- ///
- protected RoutedEventArgs RaiseTrayMiddleMouseUpEvent()
- {
- return RaiseTrayMiddleMouseUpEvent(this);
- }
-
- ///
- /// 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 RaiseTrayMiddleMouseUpEvent(DependencyObject target)
- {
- if (target == null) return null;
-
- RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = TrayMiddleMouseUpEvent;
- RoutedEventHelper.RaiseEvent(target, args);
- return args;
- }
-
- #endregion
-
- #region TrayMouseDoubleClick
-
- ///
- /// TrayMouseDoubleClick Routed Event
- ///
- 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 TrayMouseDoubleClick
- {
- add { AddHandler(TrayMouseDoubleClickEvent, value); }
- remove { RemoveHandler(TrayMouseDoubleClickEvent, value); }
- }
-
- ///
- /// A helper method to raise the TrayMouseDoubleClick event.
- ///
- protected RoutedEventArgs RaiseTrayMouseDoubleClickEvent()
- {
- RoutedEventArgs args = RaiseTrayMouseDoubleClickEvent(this);
- DoubleClickCommand.ExecuteIfEnabled(DoubleClickCommandParameter, DoubleClickCommandTarget ?? this);
- return args;
- }
-
- ///
- /// 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 RaiseTrayMouseDoubleClickEvent(DependencyObject target)
- {
- if (target == null) return null;
-
- RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = TrayMouseDoubleClickEvent;
- RoutedEventHelper.RaiseEvent(target, args);
- return args;
- }
-
- #endregion
-
- #region TrayMouseMove
-
- ///
- /// TrayMouseMove Routed Event
- ///
- 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 TrayMouseMove
- {
- add { AddHandler(TrayMouseMoveEvent, value); }
- remove { RemoveHandler(TrayMouseMoveEvent, value); }
- }
-
- ///
- /// A helper method to raise the TrayMouseMove event.
- ///
- protected RoutedEventArgs RaiseTrayMouseMoveEvent()
- {
- return RaiseTrayMouseMoveEvent(this);
- }
-
- ///
- /// 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 RaiseTrayMouseMoveEvent(DependencyObject target)
- {
- if (target == null) return null;
-
- var args = new RoutedEventArgs();
- args.RoutedEvent = TrayMouseMoveEvent;
- RoutedEventHelper.RaiseEvent(target, args);
- return args;
- }
-
- #endregion
-
- #region TrayBalloonTipShown
-
- ///
- /// TrayBalloonTipShown Routed Event
- ///
- public static readonly RoutedEvent TrayBalloonTipShownEvent =
- EventManager.RegisterRoutedEvent("TrayBalloonTipShown",
- RoutingStrategy.Bubble, typeof (RoutedEventHandler), typeof (TaskbarIcon));
-
- ///
- /// Occurs when a balloon ToolTip is displayed.
- ///
- public event RoutedEventHandler TrayBalloonTipShown
- {
- add { AddHandler(TrayBalloonTipShownEvent, value); }
- remove { RemoveHandler(TrayBalloonTipShownEvent, value); }
- }
-
- ///
- /// A helper method to raise the TrayBalloonTipShown event.
- ///
- protected RoutedEventArgs RaiseTrayBalloonTipShownEvent()
- {
- return RaiseTrayBalloonTipShownEvent(this);
- }
-
- ///
- /// 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 RaiseTrayBalloonTipShownEvent(DependencyObject target)
- {
- if (target == null) return null;
-
- RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = TrayBalloonTipShownEvent;
- RoutedEventHelper.RaiseEvent(target, args);
- return args;
- }
-
- #endregion
-
- #region TrayBalloonTipClosed
-
- ///
- /// TrayBalloonTipClosed Routed Event
- ///
- public static readonly RoutedEvent TrayBalloonTipClosedEvent =
- EventManager.RegisterRoutedEvent("TrayBalloonTipClosed",
- RoutingStrategy.Bubble, typeof (RoutedEventHandler), typeof (TaskbarIcon));
-
- ///
- /// Occurs when a balloon ToolTip was closed.
- ///
- public event RoutedEventHandler TrayBalloonTipClosed
- {
- add { AddHandler(TrayBalloonTipClosedEvent, value); }
- remove { RemoveHandler(TrayBalloonTipClosedEvent, value); }
- }
-
- ///
- /// A helper method to raise the TrayBalloonTipClosed event.
- ///
- protected RoutedEventArgs RaiseTrayBalloonTipClosedEvent()
- {
- return RaiseTrayBalloonTipClosedEvent(this);
- }
-
- ///
- /// 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 RaiseTrayBalloonTipClosedEvent(DependencyObject target)
- {
- if (target == null) return null;
-
- RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = TrayBalloonTipClosedEvent;
- RoutedEventHelper.RaiseEvent(target, args);
- return args;
- }
-
- #endregion
-
- #region TrayBalloonTipClicked
-
- ///
- /// TrayBalloonTipClicked Routed Event
- ///
- 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 TrayBalloonTipClicked
- {
- add { AddHandler(TrayBalloonTipClickedEvent, value); }
- remove { RemoveHandler(TrayBalloonTipClickedEvent, value); }
- }
-
- ///
- /// A helper method to raise the TrayBalloonTipClicked event.
- ///
- protected RoutedEventArgs RaiseTrayBalloonTipClickedEvent()
- {
- return RaiseTrayBalloonTipClickedEvent(this);
- }
-
- ///
- /// 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 RaiseTrayBalloonTipClickedEvent(DependencyObject target)
- {
- if (target == null) return null;
-
- RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = TrayBalloonTipClickedEvent;
- RoutedEventHelper.RaiseEvent(target, args);
- return args;
- }
-
- #endregion
-
- #region TrayContextMenuOpen (and PreviewTrayContextMenuOpen)
-
- ///
- /// TrayContextMenuOpen Routed Event
- ///
- 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 TrayContextMenuOpen
- {
- add { AddHandler(TrayContextMenuOpenEvent, value); }
- remove { RemoveHandler(TrayContextMenuOpenEvent, value); }
- }
-
- ///
- /// A helper method to raise the TrayContextMenuOpen event.
- ///
- protected RoutedEventArgs RaiseTrayContextMenuOpenEvent()
- {
- return RaiseTrayContextMenuOpenEvent(this);
- }
-
- ///
- /// 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 RaiseTrayContextMenuOpenEvent(DependencyObject target)
- {
- if (target == null) return null;
-
- RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = TrayContextMenuOpenEvent;
- RoutedEventHelper.RaiseEvent(target, args);
- return args;
- }
-
- ///
- /// PreviewTrayContextMenuOpen Routed Event
- ///
- 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 PreviewTrayContextMenuOpen
- {
- add { AddHandler(PreviewTrayContextMenuOpenEvent, value); }
- remove { RemoveHandler(PreviewTrayContextMenuOpenEvent, value); }
- }
-
- ///
- /// A helper method to raise the PreviewTrayContextMenuOpen event.
- ///
- protected RoutedEventArgs RaisePreviewTrayContextMenuOpenEvent()
- {
- return RaisePreviewTrayContextMenuOpenEvent(this);
- }
-
- ///
- /// 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 RaisePreviewTrayContextMenuOpenEvent(DependencyObject target)
- {
- if (target == null) return null;
-
- RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = PreviewTrayContextMenuOpenEvent;
- RoutedEventHelper.RaiseEvent(target, args);
- return args;
- }
-
- #endregion
-
- #region TrayPopupOpen (and PreviewTrayPopupOpen)
-
- ///
- /// TrayPopupOpen Routed Event
- ///
- 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 TrayPopupOpen
- {
- add { AddHandler(TrayPopupOpenEvent, value); }
- remove { RemoveHandler(TrayPopupOpenEvent, value); }
- }
-
- ///
- /// A helper method to raise the TrayPopupOpen event.
- ///
- protected RoutedEventArgs RaiseTrayPopupOpenEvent()
- {
- return RaiseTrayPopupOpenEvent(this);
- }
-
- ///
- /// 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 RaiseTrayPopupOpenEvent(DependencyObject target)
- {
- if (target == null) return null;
-
- RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = TrayPopupOpenEvent;
- RoutedEventHelper.RaiseEvent(target, args);
- return args;
- }
-
- ///
- /// PreviewTrayPopupOpen Routed Event
- ///
- 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 PreviewTrayPopupOpen
- {
- add { AddHandler(PreviewTrayPopupOpenEvent, value); }
- remove { RemoveHandler(PreviewTrayPopupOpenEvent, value); }
- }
-
- ///
- /// A helper method to raise the PreviewTrayPopupOpen event.
- ///
- protected RoutedEventArgs RaisePreviewTrayPopupOpenEvent()
- {
- return RaisePreviewTrayPopupOpenEvent(this);
- }
-
- ///
- /// 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 RaisePreviewTrayPopupOpenEvent(DependencyObject target)
- {
- if (target == null) return null;
-
- RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = PreviewTrayPopupOpenEvent;
- RoutedEventHelper.RaiseEvent(target, args);
- return args;
- }
-
- #endregion
-
- #region TrayToolTipOpen (and PreviewTrayToolTipOpen)
-
- ///
- /// TrayToolTipOpen Routed Event
- ///
- 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 TrayToolTipOpen
- {
- add { AddHandler(TrayToolTipOpenEvent, value); }
- remove { RemoveHandler(TrayToolTipOpenEvent, value); }
- }
-
- ///
- /// A helper method to raise the TrayToolTipOpen event.
- ///
- protected RoutedEventArgs RaiseTrayToolTipOpenEvent()
- {
- return RaiseTrayToolTipOpenEvent(this);
- }
-
- ///
- /// 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 RaiseTrayToolTipOpenEvent(DependencyObject target)
- {
- if (target == null) return null;
-
- RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = TrayToolTipOpenEvent;
- RoutedEventHelper.RaiseEvent(target, args);
- return args;
- }
-
- ///
- /// PreviewTrayToolTipOpen Routed Event
- ///
- 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 PreviewTrayToolTipOpen
- {
- add { AddHandler(PreviewTrayToolTipOpenEvent, value); }
- remove { RemoveHandler(PreviewTrayToolTipOpenEvent, value); }
- }
-
- ///
- /// A helper method to raise the PreviewTrayToolTipOpen event.
- ///
- protected RoutedEventArgs RaisePreviewTrayToolTipOpenEvent()
- {
- return RaisePreviewTrayToolTipOpenEvent(this);
- }
-
- ///
- /// 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 RaisePreviewTrayToolTipOpenEvent(DependencyObject target)
- {
- if (target == null) return null;
-
- RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = PreviewTrayToolTipOpenEvent;
- RoutedEventHelper.RaiseEvent(target, args);
- return args;
- }
-
- #endregion
-
- #region TrayToolTipClose (and PreviewTrayToolTipClose)
-
- ///
- /// TrayToolTipClose Routed Event
- ///
- 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 TrayToolTipClose
- {
- add { AddHandler(TrayToolTipCloseEvent, value); }
- remove { RemoveHandler(TrayToolTipCloseEvent, value); }
- }
-
- ///
- /// A helper method to raise the TrayToolTipClose event.
- ///
- protected RoutedEventArgs RaiseTrayToolTipCloseEvent()
- {
- return RaiseTrayToolTipCloseEvent(this);
- }
-
- ///
- /// 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 RaiseTrayToolTipCloseEvent(DependencyObject target)
- {
- if (target == null) return null;
-
- RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = TrayToolTipCloseEvent;
- RoutedEventHelper.RaiseEvent(target, args);
- return args;
- }
-
- ///
- /// PreviewTrayToolTipClose Routed Event
- ///
- 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 PreviewTrayToolTipClose
- {
- add { AddHandler(PreviewTrayToolTipCloseEvent, value); }
- remove { RemoveHandler(PreviewTrayToolTipCloseEvent, value); }
- }
-
- ///
- /// A helper method to raise the PreviewTrayToolTipClose event.
- ///
- protected RoutedEventArgs RaisePreviewTrayToolTipCloseEvent()
- {
- return RaisePreviewTrayToolTipCloseEvent(this);
- }
-
- ///
- /// 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 RaisePreviewTrayToolTipCloseEvent(DependencyObject target)
- {
- if (target == null) return null;
-
- RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = PreviewTrayToolTipCloseEvent;
- RoutedEventHelper.RaiseEvent(target, args);
- return args;
- }
-
- #endregion
-
- //ATTACHED EVENTS
-
- #region PopupOpened
-
- ///
- /// PopupOpened Attached Routed Event
- ///
- public static readonly RoutedEvent PopupOpenedEvent = EventManager.RegisterRoutedEvent("PopupOpened",
- RoutingStrategy.Bubble, typeof (RoutedEventHandler), typeof (TaskbarIcon));
-
- ///
- /// Adds a handler for the PopupOpened attached event
- ///
- /// UIElement or ContentElement that listens to the event
- /// Event handler to be added
- public static void AddPopupOpenedHandler(DependencyObject element, RoutedEventHandler handler)
- {
- RoutedEventHelper.AddHandler(element, PopupOpenedEvent, handler);
- }
-
- ///
- /// Removes a handler for the PopupOpened attached event
- ///
- /// UIElement or ContentElement that listens to the event
- /// Event handler to be removed
- public static void RemovePopupOpenedHandler(DependencyObject element, RoutedEventHandler handler)
- {
- RoutedEventHelper.RemoveHandler(element, PopupOpenedEvent, handler);
- }
-
- ///
- /// A static helper method to raise the PopupOpened event on a target element.
- ///
- /// UIElement or ContentElement on which to raise the event
- internal static RoutedEventArgs RaisePopupOpenedEvent(DependencyObject target)
- {
- if (target == null) return null;
-
- RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = PopupOpenedEvent;
- RoutedEventHelper.RaiseEvent(target, args);
- return args;
- }
-
- #endregion
-
- #region ToolTipOpened
-
- ///
- /// ToolTipOpened Attached Routed Event
- ///
- public static readonly RoutedEvent ToolTipOpenedEvent = EventManager.RegisterRoutedEvent("ToolTipOpened",
- RoutingStrategy.Bubble, typeof (RoutedEventHandler), typeof (TaskbarIcon));
-
- ///
- /// Adds a handler for the ToolTipOpened attached event
- ///
- /// UIElement or ContentElement that listens to the event
- /// Event handler to be added
- public static void AddToolTipOpenedHandler(DependencyObject element, RoutedEventHandler handler)
- {
- RoutedEventHelper.AddHandler(element, ToolTipOpenedEvent, handler);
- }
-
- ///
- /// Removes a handler for the ToolTipOpened attached event
- ///
- /// UIElement or ContentElement that listens to the event
- /// Event handler to be removed
- public static void RemoveToolTipOpenedHandler(DependencyObject element, RoutedEventHandler handler)
- {
- RoutedEventHelper.RemoveHandler(element, ToolTipOpenedEvent, handler);
- }
-
- ///
- /// A static helper method to raise the ToolTipOpened event on a target element.
- ///
- /// UIElement or ContentElement on which to raise the event
- internal static RoutedEventArgs RaiseToolTipOpenedEvent(DependencyObject target)
- {
- if (target == null) return null;
-
- RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = ToolTipOpenedEvent;
- RoutedEventHelper.RaiseEvent(target, args);
- return args;
- }
-
- #endregion
-
- #region ToolTipClose
-
- ///
- /// ToolTipClose Attached Routed Event
- ///
- public static readonly RoutedEvent ToolTipCloseEvent = EventManager.RegisterRoutedEvent("ToolTipClose",
- RoutingStrategy.Bubble, typeof (RoutedEventHandler), typeof (TaskbarIcon));
-
- ///
- /// Adds a handler for the ToolTipClose attached event
- ///
- /// UIElement or ContentElement that listens to the event
- /// Event handler to be added
- public static void AddToolTipCloseHandler(DependencyObject element, RoutedEventHandler handler)
- {
- RoutedEventHelper.AddHandler(element, ToolTipCloseEvent, handler);
- }
-
- ///
- /// Removes a handler for the ToolTipClose attached event
- ///
- /// UIElement or ContentElement that listens to the event
- /// Event handler to be removed
- public static void RemoveToolTipCloseHandler(DependencyObject element, RoutedEventHandler handler)
- {
- RoutedEventHelper.RemoveHandler(element, ToolTipCloseEvent, handler);
- }
-
- ///
- /// A static helper method to raise the ToolTipClose event on a target element.
- ///
- /// UIElement or ContentElement on which to raise the event
- internal static RoutedEventArgs RaiseToolTipCloseEvent(DependencyObject target)
- {
- if (target == null) return null;
-
- RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = ToolTipCloseEvent;
- RoutedEventHelper.RaiseEvent(target, args);
- return args;
- }
-
- #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
- /// The instance that manages the balloon.
- internal static RoutedEventArgs RaiseBalloonShowingEvent(DependencyObject target, TaskbarIcon source)
- {
- if (target == null) return null;
-
- RoutedEventArgs args = new RoutedEventArgs(BalloonShowingEvent, source);
- RoutedEventHelper.RaiseEvent(target, args);
- return args;
- }
-
- #endregion
-
- #region BalloonClosing
-
- ///
- /// BalloonClosing Attached Routed Event
- ///
- public static readonly RoutedEvent BalloonClosingEvent = EventManager.RegisterRoutedEvent("BalloonClosing",
- RoutingStrategy.Bubble, typeof (RoutedEventHandler), typeof (TaskbarIcon));
-
- ///
- /// Adds a handler for the BalloonClosing attached event
- ///
- /// UIElement or ContentElement that listens to the event
- /// Event handler to be added
- public static void AddBalloonClosingHandler(DependencyObject element, RoutedEventHandler handler)
- {
- RoutedEventHelper.AddHandler(element, BalloonClosingEvent, handler);
- }
-
- ///
- /// Removes a handler for the BalloonClosing attached event
- ///
- /// UIElement or ContentElement that listens to the event
- /// Event handler to be removed
- public static void RemoveBalloonClosingHandler(DependencyObject element, RoutedEventHandler handler)
- {
- RoutedEventHelper.RemoveHandler(element, BalloonClosingEvent, handler);
- }
-
- ///
- /// A static helper method to raise the BalloonClosing event on a target element.
- ///
- /// UIElement or ContentElement on which to raise the event
- /// The instance that manages the balloon.
- internal static RoutedEventArgs RaiseBalloonClosingEvent(DependencyObject target, TaskbarIcon source)
- {
- if (target == null) return null;
-
- RoutedEventArgs args = new RoutedEventArgs(BalloonClosingEvent, source);
- RoutedEventHelper.RaiseEvent(target, args);
- return args;
- }
-
- #endregion
-
- //ATTACHED PROPERTIES
-
- #region ParentTaskbarIcon
-
- ///
- /// An attached property that is assigned to displayed UI elements (balloos, tooltips, context menus), and
- /// that can be used to bind to this control. The attached property is being derived, so binding is
- /// quite straightforward:
- ///
- ///
- ///
- ///
- public static readonly DependencyProperty ParentTaskbarIconProperty =
- DependencyProperty.RegisterAttached("ParentTaskbarIcon", typeof (TaskbarIcon), typeof (TaskbarIcon),
- new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.Inherits));
-
- ///
- /// Gets the ParentTaskbarIcon property. This dependency property
- /// indicates ....
- ///
- public static TaskbarIcon GetParentTaskbarIcon(DependencyObject d)
- {
- return (TaskbarIcon) d.GetValue(ParentTaskbarIconProperty);
- }
-
- ///
- /// Sets the ParentTaskbarIcon property. This dependency property
- /// indicates ....
- ///
- public static void SetParentTaskbarIcon(DependencyObject d, TaskbarIcon value)
- {
- d.SetValue(ParentTaskbarIconProperty, value);
- }
-
- #endregion
-
- //BASE CLASS PROPERTY OVERRIDES
-
- ///
- /// Registers properties.
- ///
- static TaskbarIcon()
- {
- //register change listener for the Visibility property
- var md = new PropertyMetadata(Visibility.Visible, VisibilityPropertyChanged);
- VisibilityProperty.OverrideMetadata(typeof (TaskbarIcon), md);
-
- //register change listener for the DataContext property
- md = new FrameworkPropertyMetadata(new PropertyChangedCallback(DataContextPropertyChanged));
- DataContextProperty.OverrideMetadata(typeof (TaskbarIcon), md);
-
- //register change listener for the ContextMenu property
- md = new FrameworkPropertyMetadata(new PropertyChangedCallback(ContextMenuPropertyChanged));
- ContextMenuProperty.OverrideMetadata(typeof (TaskbarIcon), md);
- }
- }
+// hardcodet.net NotifyIcon for WPF
+// Copyright (c) 2009 - 2013 Philipp Sumi
+// Contact and Information: http://www.hardcodet.net
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the Code Project Open License (CPOL);
+// either version 1.0 of the License, or (at your option) any later
+// version.
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+//
+// THIS COPYRIGHT NOTICE MAY NOT BE REMOVED FROM THIS FILE
+
+
+using System;
+using System.ComponentModel;
+using System.Drawing;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Input;
+using System.Windows.Media;
+using Hardcodet.Wpf.TaskbarNotification.Interop;
+
+namespace Hardcodet.Wpf.TaskbarNotification
+{
+ ///
+ /// Contains declarations of WPF dependency properties
+ /// and events.
+ ///
+ partial class TaskbarIcon
+ {
+ ///
+ /// Category name that is set on designer properties.
+ ///
+ public const string CategoryName = "NotifyIcon";
+
+
+ //POPUP CONTROLS
+
+ #region TrayPopupResolved
+
+ ///
+ /// TrayPopupResolved Read-Only Dependency Property
+ ///
+ private static readonly DependencyPropertyKey TrayPopupResolvedPropertyKey
+ = DependencyProperty.RegisterReadOnly("TrayPopupResolved", typeof (Popup), typeof (TaskbarIcon),
+ new FrameworkPropertyMetadata(null));
+
+
+ ///
+ /// A read-only dependency property that returns the
+ /// that is being displayed in the taskbar area based on a user action.
+ ///
+ public static readonly DependencyProperty TrayPopupResolvedProperty
+ = TrayPopupResolvedPropertyKey.DependencyProperty;
+
+ ///
+ /// Gets the TrayPopupResolved property. Returns
+ /// a which is either the
+ /// control itself or a
+ /// control that contains the
+ /// .
+ ///
+ [Category(CategoryName)]
+ public Popup TrayPopupResolved
+ {
+ get { return (Popup) GetValue(TrayPopupResolvedProperty); }
+ }
+
+ ///
+ /// Provides a secure method for setting the TrayPopupResolved property.
+ /// This dependency property indicates ....
+ ///
+ /// The new value for the property.
+ protected void SetTrayPopupResolved(Popup value)
+ {
+ SetValue(TrayPopupResolvedPropertyKey, value);
+ }
+
+ #endregion
+
+ #region TrayToolTipResolved
+
+ ///
+ /// TrayToolTipResolved Read-Only Dependency Property
+ ///
+ private static readonly DependencyPropertyKey TrayToolTipResolvedPropertyKey
+ = DependencyProperty.RegisterReadOnly("TrayToolTipResolved", typeof (ToolTip), typeof (TaskbarIcon),
+ new FrameworkPropertyMetadata(null));
+
+
+ ///
+ /// A read-only dependency property that returns the
+ /// that is being displayed.
+ ///
+ public static readonly DependencyProperty TrayToolTipResolvedProperty
+ = TrayToolTipResolvedPropertyKey.DependencyProperty;
+
+ ///
+ /// Gets the TrayToolTipResolved property. Returns
+ /// a control that was created
+ /// in order to display either
+ /// or .
+ ///
+ [Category(CategoryName)]
+ [Browsable(true)]
+ [Bindable(true)]
+ public ToolTip TrayToolTipResolved
+ {
+ get { return (ToolTip) GetValue(TrayToolTipResolvedProperty); }
+ }
+
+ ///
+ /// Provides a secure method for setting the
+ /// property.
+ ///
+ /// The new value for the property.
+ protected void SetTrayToolTipResolved(ToolTip 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));
+
+ ///
+ /// Maintains a currently displayed custom balloon.
+ ///
+ 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 property.
+ ///
+ /// The new value for the property.
+ protected void SetCustomBalloon(Popup value)
+ {
+ SetValue(CustomBalloonPropertyKey, value);
+ }
+
+ #endregion
+
+ //DEPENDENCY PROPERTIES
+
+ #region Icon property / IconSource dependency property
+
+ private Icon icon;
+
+ ///
+ /// Gets or sets the icon to be displayed. This is not a
+ /// dependency property - if you want to assign the property
+ /// through XAML, please use the
+ /// dependency property.
+ ///
+ [Browsable(false)]
+ public Icon Icon
+ {
+ get { return icon; }
+ set
+ {
+ icon = value;
+ iconData.IconHandle = value == null ? IntPtr.Zero : icon.Handle;
+
+ Util.WriteIconData(ref iconData, NotifyCommand.Modify, IconDataMembers.Icon);
+ }
+ }
+
+
+ ///
+ /// Resolves an image source and updates the property accordingly.
+ ///
+ public static readonly DependencyProperty IconSourceProperty =
+ DependencyProperty.Register("IconSource",
+ typeof (ImageSource),
+ typeof (TaskbarIcon),
+ new FrameworkPropertyMetadata(null, IconSourcePropertyChanged));
+
+ ///
+ /// A property wrapper for the
+ /// dependency property:
+ /// Resolves an image source and updates the property accordingly.
+ ///
+ [Category(CategoryName)]
+ [Description("Sets the displayed taskbar icon.")]
+ public ImageSource IconSource
+ {
+ get { return (ImageSource) GetValue(IconSourceProperty); }
+ set { SetValue(IconSourceProperty, value); }
+ }
+
+
+ ///
+ /// A static callback listener which is being invoked if 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 IconSourcePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ TaskbarIcon owner = (TaskbarIcon) d;
+ owner.OnIconSourcePropertyChanged(e);
+ }
+
+
+ ///
+ /// 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
+ /// should be handled here.
+ ///
+ /// Provides information about the updated property.
+ private void OnIconSourcePropertyChanged(DependencyPropertyChangedEventArgs e)
+ {
+ ImageSource newValue = (ImageSource) e.NewValue;
+
+ //resolving the ImageSource at design time is unlikely to work
+ if (!Util.IsDesignMode) Icon = newValue.ToIcon();
+ }
+
+ #endregion
+
+ #region ToolTipText dependency property
+
+ ///
+ /// A tooltip text that is being displayed if no custom
+ /// was set or if custom tooltips are not supported.
+ ///
+ public static readonly DependencyProperty ToolTipTextProperty =
+ DependencyProperty.Register("ToolTipText",
+ typeof (string),
+ typeof (TaskbarIcon),
+ new FrameworkPropertyMetadata(String.Empty, ToolTipTextPropertyChanged));
+
+
+ ///
+ /// A property wrapper for the
+ /// dependency property:
+ /// A tooltip text that is being displayed if no custom
+ /// was set or if custom tooltips are not supported.
+ ///
+ [Category(CategoryName)]
+ [Description("Alternative to a fully blown ToolTip, which is only displayed on Vista and above.")]
+ public string ToolTipText
+ {
+ get { return (string) GetValue(ToolTipTextProperty); }
+ set { SetValue(ToolTipTextProperty, value); }
+ }
+
+
+ ///
+ /// A static callback listener which is being invoked if 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 ToolTipTextPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ TaskbarIcon owner = (TaskbarIcon) d;
+ owner.OnToolTipTextPropertyChanged(e);
+ }
+
+
+ ///
+ /// 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
+ /// should be handled here.
+ ///
+ /// Provides information about the updated property.
+ private void OnToolTipTextPropertyChanged(DependencyPropertyChangedEventArgs e)
+ {
+ //do not touch tooltips if we have a custom tooltip element
+ if (TrayToolTip == null)
+ {
+ ToolTip currentToolTip = TrayToolTipResolved;
+ if (currentToolTip == null)
+ {
+ //if we don't have a wrapper tooltip for the tooltip text, create it now
+ CreateCustomToolTip();
+ }
+ else
+ {
+ //if we have a wrapper tooltip that shows the old tooltip text, just update content
+ currentToolTip.Content = e.NewValue;
+ }
+ }
+
+ WriteToolTipSettings();
+ }
+
+ #endregion
+
+ #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 TrayToolTipProperty =
+ DependencyProperty.Register("TrayToolTip",
+ typeof (UIElement),
+ typeof (TaskbarIcon),
+ new FrameworkPropertyMetadata(null, TrayToolTipPropertyChanged));
+
+ ///
+ /// 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
+ /// the property is set as well.
+ ///
+ [Category(CategoryName)]
+ [Description("Custom UI element that is displayed as a tooltip. Only on Vista and above")]
+ public UIElement TrayToolTip
+ {
+ 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
+ /// instance method of the changed instance.
+ ///
+ /// The currently processed owner of the property.
+ /// Provides information about the updated property.
+ private static void TrayToolTipPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ TaskbarIcon owner = (TaskbarIcon) d;
+ owner.OnTrayToolTipPropertyChanged(e);
+ }
+
+
+ ///
+ /// 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
+ /// should be handled here.
+ ///
+ /// Provides information about the updated property.
+ private void OnTrayToolTipPropertyChanged(DependencyPropertyChangedEventArgs e)
+ {
+ //recreate tooltip control
+ CreateCustomToolTip();
+
+ if (e.OldValue != null)
+ {
+ //remove the taskbar icon reference from the previously used element
+ SetParentTaskbarIcon((DependencyObject) e.OldValue, null);
+ }
+
+ if (e.NewValue != null)
+ {
+ //set this taskbar icon as a reference to the new tooltip element
+ SetParentTaskbarIcon((DependencyObject) e.NewValue, this);
+ }
+
+ //update tooltip settings - needed to make sure a string is set, even
+ //if the ToolTipText property is not set. Otherwise, the event that
+ //triggers tooltip display is never fired.
+ WriteToolTipSettings();
+ }
+
+ #endregion
+
+ #region TrayPopup dependency property
+
+ ///
+ /// A control that is displayed as a popup when the taskbar icon is clicked.
+ ///
+ public static readonly DependencyProperty TrayPopupProperty =
+ DependencyProperty.Register("TrayPopup",
+ typeof (UIElement),
+ typeof (TaskbarIcon),
+ new FrameworkPropertyMetadata(null, TrayPopupPropertyChanged));
+
+ ///
+ /// 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 TrayPopup
+ {
+ 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
+ /// instance method of the changed instance.
+ ///
+ /// The currently processed owner of the property.
+ /// Provides information about the updated property.
+ private static void TrayPopupPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ TaskbarIcon owner = (TaskbarIcon) d;
+ owner.OnTrayPopupPropertyChanged(e);
+ }
+
+
+ ///
+ /// 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
+ /// should be handled here.
+ ///
+ /// Provides information about the updated property.
+ private void OnTrayPopupPropertyChanged(DependencyPropertyChangedEventArgs e)
+ {
+ if (e.OldValue != null)
+ {
+ //remove the taskbar icon reference from the previously used element
+ SetParentTaskbarIcon((DependencyObject) e.OldValue, null);
+ }
+
+
+ if (e.NewValue != null)
+ {
+ //set this taskbar icon as a reference to the new tooltip element
+ SetParentTaskbarIcon((DependencyObject) e.NewValue, this);
+ }
+
+ //create a pop
+ CreatePopup();
+ }
+
+ #endregion
+
+ #region MenuActivation dependency property
+
+ ///
+ /// Defines what mouse events display the context menu.
+ /// Defaults to .
+ ///
+ public static readonly DependencyProperty MenuActivationProperty =
+ DependencyProperty.Register("MenuActivation",
+ typeof (PopupActivationMode),
+ typeof (TaskbarIcon),
+ new FrameworkPropertyMetadata(PopupActivationMode.RightClick));
+
+ ///
+ /// A property wrapper for the
+ /// dependency property:
+ /// Defines what mouse events display the context menu.
+ /// Defaults to .
+ ///
+ [Category(CategoryName)]
+ [Description("Defines what mouse events display the context menu.")]
+ public PopupActivationMode MenuActivation
+ {
+ get { return (PopupActivationMode) GetValue(MenuActivationProperty); }
+ set { SetValue(MenuActivationProperty, value); }
+ }
+
+ #endregion
+
+ #region PopupActivation dependency property
+
+ ///
+ /// Defines what mouse events trigger the .
+ /// Default is .
+ ///
+ public static readonly DependencyProperty PopupActivationProperty =
+ DependencyProperty.Register("PopupActivation",
+ typeof (PopupActivationMode),
+ typeof (TaskbarIcon),
+ new FrameworkPropertyMetadata(PopupActivationMode.LeftClick));
+
+ ///
+ /// A property wrapper for the
+ /// dependency property:
+ /// Defines what mouse events trigger the .
+ /// Default is .
+ ///
+ [Category(CategoryName)]
+ [Description("Defines what mouse events display the TaskbarIconPopup.")]
+ public PopupActivationMode PopupActivation
+ {
+ get { return (PopupActivationMode) GetValue(PopupActivationProperty); }
+ set { SetValue(PopupActivationProperty, value); }
+ }
+
+ #endregion
+
+ #region Visibility dependency property override
+
+ ///
+ /// A static callback listener which is being invoked if 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 VisibilityPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ TaskbarIcon owner = (TaskbarIcon) d;
+ owner.OnVisibilityPropertyChanged(e);
+ }
+
+
+ ///
+ /// 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
+ /// should be handled here.
+ ///
+ /// Provides information about the updated property.
+ private void OnVisibilityPropertyChanged(DependencyPropertyChangedEventArgs e)
+ {
+ Visibility newValue = (Visibility) e.NewValue;
+
+ //update
+ if (newValue == Visibility.Visible)
+ {
+ CreateTaskbarIcon();
+ }
+ else
+ {
+ RemoveTaskbarIcon();
+ }
+ }
+
+ #endregion
+
+ #region DataContext dependency property override / target update
+
+ ///
+ /// Updates the of a given
+ /// . This method only updates target elements
+ /// that do not already have a data context of their own, and either assigns
+ /// the of the NotifyIcon, or the
+ /// NotifyIcon itself, if no data context was assigned at all.
+ ///
+ private void UpdateDataContext(FrameworkElement target, object oldDataContextValue, object newDataContextValue)
+ {
+ //if there is no target or it's data context is determined through a binding
+ //of its own, keep it
+ if (target == null || target.IsDataContextDataBound()) return;
+
+ //if the target's data context is the NotifyIcon's old DataContext or the NotifyIcon itself,
+ //update it
+ if (ReferenceEquals(this, target.DataContext) || Equals(oldDataContextValue, target.DataContext))
+ {
+ //assign own data context, if available. If there is no data
+ //context at all, assign NotifyIcon itself.
+ target.DataContext = newDataContextValue ?? this;
+ }
+ }
+
+ ///
+ /// A static callback listener which is being invoked if 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 DataContextPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ TaskbarIcon owner = (TaskbarIcon) d;
+ owner.OnDataContextPropertyChanged(e);
+ }
+
+
+ ///
+ /// 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
+ /// should be handled here.
+ ///
+ /// Provides information about the updated property.
+ private void OnDataContextPropertyChanged(DependencyPropertyChangedEventArgs e)
+ {
+ object newValue = e.NewValue;
+ object oldValue = e.OldValue;
+
+ //replace custom data context for ToolTips, Popup, and
+ //ContextMenu
+ UpdateDataContext(TrayPopupResolved, oldValue, newValue);
+ UpdateDataContext(TrayToolTipResolved, oldValue, newValue);
+ UpdateDataContext(ContextMenu, oldValue, newValue);
+ }
+
+ #endregion
+
+ #region ContextMenu dependency property override
+
+ ///
+ /// A static callback listener which is being invoked if 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 ContextMenuPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ TaskbarIcon owner = (TaskbarIcon) d;
+ owner.OnContextMenuPropertyChanged(e);
+ }
+
+
+ ///
+ /// Releases the old and updates the new property
+ /// in order to reflect both the NotifyIcon's
+ /// property and have the assigned.
+ ///
+ /// Provides information about the updated property.
+ private void OnContextMenuPropertyChanged(DependencyPropertyChangedEventArgs e)
+ {
+ if (e.OldValue != null)
+ {
+ //remove the taskbar icon reference from the previously used element
+ SetParentTaskbarIcon((DependencyObject) e.OldValue, null);
+ }
+
+ if (e.NewValue != null)
+ {
+ //set this taskbar icon as a reference to the new tooltip element
+ SetParentTaskbarIcon((DependencyObject) e.NewValue, this);
+ }
+
+ UpdateDataContext((ContextMenu) e.NewValue, null, DataContext);
+ }
+
+ #endregion
+
+ #region DoubleClickCommand dependency property
+
+ ///
+ /// Associates a command that is being executed if the tray icon is being
+ /// double clicked.
+ ///
+ public static readonly DependencyProperty DoubleClickCommandProperty =
+ DependencyProperty.Register("DoubleClickCommand",
+ typeof (ICommand),
+ typeof (TaskbarIcon),
+ new FrameworkPropertyMetadata(null));
+
+ ///
+ /// A property wrapper for the
+ /// dependency property:
+ /// Associates a command that is being executed if the tray icon is being
+ /// double clicked.
+ ///
+ [Category(CategoryName)]
+ [Description("A command that is being executed if the tray icon is being double-clicked.")]
+ public ICommand DoubleClickCommand
+ {
+ get { return (ICommand) GetValue(DoubleClickCommandProperty); }
+ set { SetValue(DoubleClickCommandProperty, value); }
+ }
+
+ #endregion
+
+ #region DoubleClickCommandParameter dependency property
+
+ ///
+ /// Command parameter for the .
+ ///
+ public static readonly DependencyProperty DoubleClickCommandParameterProperty =
+ DependencyProperty.Register("DoubleClickCommandParameter",
+ typeof (object),
+ typeof (TaskbarIcon),
+ new FrameworkPropertyMetadata(null));
+
+ ///
+ /// A property wrapper for the
+ /// dependency property:
+ /// Command parameter for the .
+ ///
+ [Category(CategoryName)]
+ [Description("Parameter to submit to the DoubleClickCommand when the user double clicks on the NotifyIcon.")]
+ public object DoubleClickCommandParameter
+ {
+ get { return GetValue(DoubleClickCommandParameterProperty); }
+ set { SetValue(DoubleClickCommandParameterProperty, value); }
+ }
+
+ #endregion
+
+ #region DoubleClickCommandTarget dependency property
+
+ ///
+ /// The target of the command that is fired if the notify icon is double clicked.
+ ///
+ public static readonly DependencyProperty DoubleClickCommandTargetProperty =
+ DependencyProperty.Register("DoubleClickCommandTarget",
+ typeof (IInputElement),
+ typeof (TaskbarIcon),
+ new FrameworkPropertyMetadata(null));
+
+ ///
+ /// A property wrapper for the
+ /// dependency property:
+ /// The target of the command that is fired if the notify icon is double clicked.
+ ///
+ [Category(CategoryName)]
+ [Description("The target of the command that is fired if the notify icon is double clicked.")]
+ public IInputElement DoubleClickCommandTarget
+ {
+ get { return (IInputElement) GetValue(DoubleClickCommandTargetProperty); }
+ set { SetValue(DoubleClickCommandTargetProperty, value); }
+ }
+
+ #endregion
+
+ #region LeftClickCommand dependency property
+
+ ///
+ /// Associates a command that is being executed if the tray icon is being
+ /// double clicked.
+ ///
+ public static readonly DependencyProperty LeftClickCommandProperty =
+ DependencyProperty.Register("LeftClickCommand",
+ typeof (ICommand),
+ typeof (TaskbarIcon),
+ new FrameworkPropertyMetadata(null));
+
+ ///
+ /// A property wrapper for the
+ /// dependency property:
+ /// Associates a command that is being executed if the tray icon is being
+ /// left-clicked.
+ ///
+ [Category(CategoryName)]
+ [Description("A command that is being executed if the tray icon is being left-clicked.")]
+ public ICommand LeftClickCommand
+ {
+ get { return (ICommand) GetValue(LeftClickCommandProperty); }
+ set { SetValue(LeftClickCommandProperty, value); }
+ }
+
+ #endregion
+
+ #region LeftClickCommandParameter dependency property
+
+ ///
+ /// Command parameter for the .
+ ///
+ public static readonly DependencyProperty LeftClickCommandParameterProperty =
+ DependencyProperty.Register("LeftClickCommandParameter",
+ typeof (object),
+ typeof (TaskbarIcon),
+ new FrameworkPropertyMetadata(null));
+
+ ///
+ /// A property wrapper for the
+ /// dependency property:
+ /// Command parameter for the .
+ ///
+ [Category(CategoryName)]
+ [Description("The target of the command that is fired if the notify icon is clicked with the left mouse button."
+ )]
+ public object LeftClickCommandParameter
+ {
+ get { return GetValue(LeftClickCommandParameterProperty); }
+ set { SetValue(LeftClickCommandParameterProperty, value); }
+ }
+
+ #endregion
+
+ #region LeftClickCommandTarget dependency property
+
+ ///
+ /// The target of the command that is fired if the notify icon is clicked.
+ ///
+ public static readonly DependencyProperty LeftClickCommandTargetProperty =
+ DependencyProperty.Register("LeftClickCommandTarget",
+ typeof (IInputElement),
+ typeof (TaskbarIcon),
+ new FrameworkPropertyMetadata(null));
+
+ ///
+ /// A property wrapper for the
+ /// dependency property:
+ /// The target of the command that is fired if the notify icon is clicked.
+ ///
+ [Category(CategoryName)]
+ [Description("The target of the command that is fired if the notify icon is clicked with the left mouse button."
+ )]
+ public IInputElement LeftClickCommandTarget
+ {
+ get { return (IInputElement) GetValue(LeftClickCommandTargetProperty); }
+ set { SetValue(LeftClickCommandTargetProperty, value); }
+ }
+
+ #endregion
+
+ //EVENTS
+
+ #region TrayLeftMouseDown
+
+ ///
+ /// TrayLeftMouseDown Routed Event
+ ///
+ 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 TrayLeftMouseDown
+ {
+ add { AddHandler(TrayLeftMouseDownEvent, value); }
+ remove { RemoveHandler(TrayLeftMouseDownEvent, value); }
+ }
+
+ ///
+ /// A helper method to raise the TrayLeftMouseDown event.
+ ///
+ protected RoutedEventArgs RaiseTrayLeftMouseDownEvent()
+ {
+ RoutedEventArgs args = RaiseTrayLeftMouseDownEvent(this);
+ return args;
+ }
+
+ ///
+ /// 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 RaiseTrayLeftMouseDownEvent(DependencyObject target)
+ {
+ if (target == null) return null;
+
+ RoutedEventArgs args = new RoutedEventArgs();
+ args.RoutedEvent = TrayLeftMouseDownEvent;
+ RoutedEventHelper.RaiseEvent(target, args);
+ return args;
+ }
+
+ #endregion
+
+ #region TrayRightMouseDown
+
+ ///
+ /// TrayRightMouseDown Routed Event
+ ///
+ 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 TrayRightMouseDown
+ {
+ add { AddHandler(TrayRightMouseDownEvent, value); }
+ remove { RemoveHandler(TrayRightMouseDownEvent, value); }
+ }
+
+ ///
+ /// A helper method to raise the TrayRightMouseDown event.
+ ///
+ protected RoutedEventArgs RaiseTrayRightMouseDownEvent()
+ {
+ return RaiseTrayRightMouseDownEvent(this);
+ }
+
+ ///
+ /// 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 RaiseTrayRightMouseDownEvent(DependencyObject target)
+ {
+ if (target == null) return null;
+
+ RoutedEventArgs args = new RoutedEventArgs();
+ args.RoutedEvent = TrayRightMouseDownEvent;
+ RoutedEventHelper.RaiseEvent(target, args);
+ return args;
+ }
+
+ #endregion
+
+ #region TrayMiddleMouseDown
+
+ ///
+ /// TrayMiddleMouseDown Routed Event
+ ///
+ 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 TrayMiddleMouseDown
+ {
+ add { AddHandler(TrayMiddleMouseDownEvent, value); }
+ remove { RemoveHandler(TrayMiddleMouseDownEvent, value); }
+ }
+
+ ///
+ /// A helper method to raise the TrayMiddleMouseDown event.
+ ///
+ protected RoutedEventArgs RaiseTrayMiddleMouseDownEvent()
+ {
+ return RaiseTrayMiddleMouseDownEvent(this);
+ }
+
+ ///
+ /// 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 RaiseTrayMiddleMouseDownEvent(DependencyObject target)
+ {
+ if (target == null) return null;
+
+ RoutedEventArgs args = new RoutedEventArgs();
+ args.RoutedEvent = TrayMiddleMouseDownEvent;
+ RoutedEventHelper.RaiseEvent(target, args);
+ return args;
+ }
+
+ #endregion
+
+ #region TrayLeftMouseUp
+
+ ///
+ /// TrayLeftMouseUp Routed Event
+ ///
+ 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 TrayLeftMouseUp
+ {
+ add { AddHandler(TrayLeftMouseUpEvent, value); }
+ remove { RemoveHandler(TrayLeftMouseUpEvent, value); }
+ }
+
+ ///
+ /// A helper method to raise the TrayLeftMouseUp event.
+ ///
+ protected RoutedEventArgs RaiseTrayLeftMouseUpEvent()
+ {
+ return RaiseTrayLeftMouseUpEvent(this);
+ }
+
+ ///
+ /// 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 RaiseTrayLeftMouseUpEvent(DependencyObject target)
+ {
+ if (target == null) return null;
+
+ RoutedEventArgs args = new RoutedEventArgs();
+ args.RoutedEvent = TrayLeftMouseUpEvent;
+ RoutedEventHelper.RaiseEvent(target, args);
+ return args;
+ }
+
+ #endregion
+
+ #region TrayRightMouseUp
+
+ ///
+ /// TrayRightMouseUp Routed Event
+ ///
+ 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 TrayRightMouseUp
+ {
+ add { AddHandler(TrayRightMouseUpEvent, value); }
+ remove { RemoveHandler(TrayRightMouseUpEvent, value); }
+ }
+
+ ///
+ /// A helper method to raise the TrayRightMouseUp event.
+ ///
+ protected RoutedEventArgs RaiseTrayRightMouseUpEvent()
+ {
+ return RaiseTrayRightMouseUpEvent(this);
+ }
+
+ ///
+ /// 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 RaiseTrayRightMouseUpEvent(DependencyObject target)
+ {
+ if (target == null) return null;
+
+ RoutedEventArgs args = new RoutedEventArgs();
+ args.RoutedEvent = TrayRightMouseUpEvent;
+ RoutedEventHelper.RaiseEvent(target, args);
+ return args;
+ }
+
+ #endregion
+
+ #region TrayMiddleMouseUp
+
+ ///
+ /// TrayMiddleMouseUp Routed Event
+ ///
+ 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 TrayMiddleMouseUp
+ {
+ add { AddHandler(TrayMiddleMouseUpEvent, value); }
+ remove { RemoveHandler(TrayMiddleMouseUpEvent, value); }
+ }
+
+ ///
+ /// A helper method to raise the TrayMiddleMouseUp event.
+ ///
+ protected RoutedEventArgs RaiseTrayMiddleMouseUpEvent()
+ {
+ return RaiseTrayMiddleMouseUpEvent(this);
+ }
+
+ ///
+ /// 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 RaiseTrayMiddleMouseUpEvent(DependencyObject target)
+ {
+ if (target == null) return null;
+
+ RoutedEventArgs args = new RoutedEventArgs();
+ args.RoutedEvent = TrayMiddleMouseUpEvent;
+ RoutedEventHelper.RaiseEvent(target, args);
+ return args;
+ }
+
+ #endregion
+
+ #region TrayMouseDoubleClick
+
+ ///
+ /// TrayMouseDoubleClick Routed Event
+ ///
+ 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 TrayMouseDoubleClick
+ {
+ add { AddHandler(TrayMouseDoubleClickEvent, value); }
+ remove { RemoveHandler(TrayMouseDoubleClickEvent, value); }
+ }
+
+ ///
+ /// A helper method to raise the TrayMouseDoubleClick event.
+ ///
+ protected RoutedEventArgs RaiseTrayMouseDoubleClickEvent()
+ {
+ RoutedEventArgs args = RaiseTrayMouseDoubleClickEvent(this);
+ DoubleClickCommand.ExecuteIfEnabled(DoubleClickCommandParameter, DoubleClickCommandTarget ?? this);
+ return args;
+ }
+
+ ///
+ /// 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 RaiseTrayMouseDoubleClickEvent(DependencyObject target)
+ {
+ if (target == null) return null;
+
+ RoutedEventArgs args = new RoutedEventArgs();
+ args.RoutedEvent = TrayMouseDoubleClickEvent;
+ RoutedEventHelper.RaiseEvent(target, args);
+ return args;
+ }
+
+ #endregion
+
+ #region TrayMouseMove
+
+ ///
+ /// TrayMouseMove Routed Event
+ ///
+ 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 TrayMouseMove
+ {
+ add { AddHandler(TrayMouseMoveEvent, value); }
+ remove { RemoveHandler(TrayMouseMoveEvent, value); }
+ }
+
+ ///
+ /// A helper method to raise the TrayMouseMove event.
+ ///
+ protected RoutedEventArgs RaiseTrayMouseMoveEvent()
+ {
+ return RaiseTrayMouseMoveEvent(this);
+ }
+
+ ///
+ /// 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 RaiseTrayMouseMoveEvent(DependencyObject target)
+ {
+ if (target == null) return null;
+
+ var args = new RoutedEventArgs();
+ args.RoutedEvent = TrayMouseMoveEvent;
+ RoutedEventHelper.RaiseEvent(target, args);
+ return args;
+ }
+
+ #endregion
+
+ #region TrayBalloonTipShown
+
+ ///
+ /// TrayBalloonTipShown Routed Event
+ ///
+ public static readonly RoutedEvent TrayBalloonTipShownEvent =
+ EventManager.RegisterRoutedEvent("TrayBalloonTipShown",
+ RoutingStrategy.Bubble, typeof (RoutedEventHandler), typeof (TaskbarIcon));
+
+ ///
+ /// Occurs when a balloon ToolTip is displayed.
+ ///
+ public event RoutedEventHandler TrayBalloonTipShown
+ {
+ add { AddHandler(TrayBalloonTipShownEvent, value); }
+ remove { RemoveHandler(TrayBalloonTipShownEvent, value); }
+ }
+
+ ///
+ /// A helper method to raise the TrayBalloonTipShown event.
+ ///
+ protected RoutedEventArgs RaiseTrayBalloonTipShownEvent()
+ {
+ return RaiseTrayBalloonTipShownEvent(this);
+ }
+
+ ///
+ /// 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 RaiseTrayBalloonTipShownEvent(DependencyObject target)
+ {
+ if (target == null) return null;
+
+ RoutedEventArgs args = new RoutedEventArgs();
+ args.RoutedEvent = TrayBalloonTipShownEvent;
+ RoutedEventHelper.RaiseEvent(target, args);
+ return args;
+ }
+
+ #endregion
+
+ #region TrayBalloonTipClosed
+
+ ///
+ /// TrayBalloonTipClosed Routed Event
+ ///
+ public static readonly RoutedEvent TrayBalloonTipClosedEvent =
+ EventManager.RegisterRoutedEvent("TrayBalloonTipClosed",
+ RoutingStrategy.Bubble, typeof (RoutedEventHandler), typeof (TaskbarIcon));
+
+ ///
+ /// Occurs when a balloon ToolTip was closed.
+ ///
+ public event RoutedEventHandler TrayBalloonTipClosed
+ {
+ add { AddHandler(TrayBalloonTipClosedEvent, value); }
+ remove { RemoveHandler(TrayBalloonTipClosedEvent, value); }
+ }
+
+ ///
+ /// A helper method to raise the TrayBalloonTipClosed event.
+ ///
+ protected RoutedEventArgs RaiseTrayBalloonTipClosedEvent()
+ {
+ return RaiseTrayBalloonTipClosedEvent(this);
+ }
+
+ ///
+ /// 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 RaiseTrayBalloonTipClosedEvent(DependencyObject target)
+ {
+ if (target == null) return null;
+
+ RoutedEventArgs args = new RoutedEventArgs();
+ args.RoutedEvent = TrayBalloonTipClosedEvent;
+ RoutedEventHelper.RaiseEvent(target, args);
+ return args;
+ }
+
+ #endregion
+
+ #region TrayBalloonTipClicked
+
+ ///
+ /// TrayBalloonTipClicked Routed Event
+ ///
+ 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 TrayBalloonTipClicked
+ {
+ add { AddHandler(TrayBalloonTipClickedEvent, value); }
+ remove { RemoveHandler(TrayBalloonTipClickedEvent, value); }
+ }
+
+ ///
+ /// A helper method to raise the TrayBalloonTipClicked event.
+ ///
+ protected RoutedEventArgs RaiseTrayBalloonTipClickedEvent()
+ {
+ return RaiseTrayBalloonTipClickedEvent(this);
+ }
+
+ ///
+ /// 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 RaiseTrayBalloonTipClickedEvent(DependencyObject target)
+ {
+ if (target == null) return null;
+
+ RoutedEventArgs args = new RoutedEventArgs();
+ args.RoutedEvent = TrayBalloonTipClickedEvent;
+ RoutedEventHelper.RaiseEvent(target, args);
+ return args;
+ }
+
+ #endregion
+
+ #region TrayContextMenuOpen (and PreviewTrayContextMenuOpen)
+
+ ///
+ /// TrayContextMenuOpen Routed Event
+ ///
+ 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 TrayContextMenuOpen
+ {
+ add { AddHandler(TrayContextMenuOpenEvent, value); }
+ remove { RemoveHandler(TrayContextMenuOpenEvent, value); }
+ }
+
+ ///
+ /// A helper method to raise the TrayContextMenuOpen event.
+ ///
+ protected RoutedEventArgs RaiseTrayContextMenuOpenEvent()
+ {
+ return RaiseTrayContextMenuOpenEvent(this);
+ }
+
+ ///
+ /// 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 RaiseTrayContextMenuOpenEvent(DependencyObject target)
+ {
+ if (target == null) return null;
+
+ RoutedEventArgs args = new RoutedEventArgs();
+ args.RoutedEvent = TrayContextMenuOpenEvent;
+ RoutedEventHelper.RaiseEvent(target, args);
+ return args;
+ }
+
+ ///
+ /// PreviewTrayContextMenuOpen Routed Event
+ ///
+ 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 PreviewTrayContextMenuOpen
+ {
+ add { AddHandler(PreviewTrayContextMenuOpenEvent, value); }
+ remove { RemoveHandler(PreviewTrayContextMenuOpenEvent, value); }
+ }
+
+ ///
+ /// A helper method to raise the PreviewTrayContextMenuOpen event.
+ ///
+ protected RoutedEventArgs RaisePreviewTrayContextMenuOpenEvent()
+ {
+ return RaisePreviewTrayContextMenuOpenEvent(this);
+ }
+
+ ///
+ /// 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 RaisePreviewTrayContextMenuOpenEvent(DependencyObject target)
+ {
+ if (target == null) return null;
+
+ RoutedEventArgs args = new RoutedEventArgs();
+ args.RoutedEvent = PreviewTrayContextMenuOpenEvent;
+ RoutedEventHelper.RaiseEvent(target, args);
+ return args;
+ }
+
+ #endregion
+
+ #region TrayPopupOpen (and PreviewTrayPopupOpen)
+
+ ///
+ /// TrayPopupOpen Routed Event
+ ///
+ 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 TrayPopupOpen
+ {
+ add { AddHandler(TrayPopupOpenEvent, value); }
+ remove { RemoveHandler(TrayPopupOpenEvent, value); }
+ }
+
+ ///
+ /// A helper method to raise the TrayPopupOpen event.
+ ///
+ protected RoutedEventArgs RaiseTrayPopupOpenEvent()
+ {
+ return RaiseTrayPopupOpenEvent(this);
+ }
+
+ ///
+ /// 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 RaiseTrayPopupOpenEvent(DependencyObject target)
+ {
+ if (target == null) return null;
+
+ RoutedEventArgs args = new RoutedEventArgs();
+ args.RoutedEvent = TrayPopupOpenEvent;
+ RoutedEventHelper.RaiseEvent(target, args);
+ return args;
+ }
+
+ ///
+ /// PreviewTrayPopupOpen Routed Event
+ ///
+ 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 PreviewTrayPopupOpen
+ {
+ add { AddHandler(PreviewTrayPopupOpenEvent, value); }
+ remove { RemoveHandler(PreviewTrayPopupOpenEvent, value); }
+ }
+
+ ///
+ /// A helper method to raise the PreviewTrayPopupOpen event.
+ ///
+ protected RoutedEventArgs RaisePreviewTrayPopupOpenEvent()
+ {
+ return RaisePreviewTrayPopupOpenEvent(this);
+ }
+
+ ///
+ /// 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 RaisePreviewTrayPopupOpenEvent(DependencyObject target)
+ {
+ if (target == null) return null;
+
+ RoutedEventArgs args = new RoutedEventArgs();
+ args.RoutedEvent = PreviewTrayPopupOpenEvent;
+ RoutedEventHelper.RaiseEvent(target, args);
+ return args;
+ }
+
+ #endregion
+
+ #region TrayToolTipOpen (and PreviewTrayToolTipOpen)
+
+ ///
+ /// TrayToolTipOpen Routed Event
+ ///
+ 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 TrayToolTipOpen
+ {
+ add { AddHandler(TrayToolTipOpenEvent, value); }
+ remove { RemoveHandler(TrayToolTipOpenEvent, value); }
+ }
+
+ ///
+ /// A helper method to raise the TrayToolTipOpen event.
+ ///
+ protected RoutedEventArgs RaiseTrayToolTipOpenEvent()
+ {
+ return RaiseTrayToolTipOpenEvent(this);
+ }
+
+ ///
+ /// 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 RaiseTrayToolTipOpenEvent(DependencyObject target)
+ {
+ if (target == null) return null;
+
+ RoutedEventArgs args = new RoutedEventArgs();
+ args.RoutedEvent = TrayToolTipOpenEvent;
+ RoutedEventHelper.RaiseEvent(target, args);
+ return args;
+ }
+
+ ///
+ /// PreviewTrayToolTipOpen Routed Event
+ ///
+ 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 PreviewTrayToolTipOpen
+ {
+ add { AddHandler(PreviewTrayToolTipOpenEvent, value); }
+ remove { RemoveHandler(PreviewTrayToolTipOpenEvent, value); }
+ }
+
+ ///
+ /// A helper method to raise the PreviewTrayToolTipOpen event.
+ ///
+ protected RoutedEventArgs RaisePreviewTrayToolTipOpenEvent()
+ {
+ return RaisePreviewTrayToolTipOpenEvent(this);
+ }
+
+ ///
+ /// 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 RaisePreviewTrayToolTipOpenEvent(DependencyObject target)
+ {
+ if (target == null) return null;
+
+ RoutedEventArgs args = new RoutedEventArgs();
+ args.RoutedEvent = PreviewTrayToolTipOpenEvent;
+ RoutedEventHelper.RaiseEvent(target, args);
+ return args;
+ }
+
+ #endregion
+
+ #region TrayToolTipClose (and PreviewTrayToolTipClose)
+
+ ///
+ /// TrayToolTipClose Routed Event
+ ///
+ 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 TrayToolTipClose
+ {
+ add { AddHandler(TrayToolTipCloseEvent, value); }
+ remove { RemoveHandler(TrayToolTipCloseEvent, value); }
+ }
+
+ ///
+ /// A helper method to raise the TrayToolTipClose event.
+ ///
+ protected RoutedEventArgs RaiseTrayToolTipCloseEvent()
+ {
+ return RaiseTrayToolTipCloseEvent(this);
+ }
+
+ ///
+ /// 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 RaiseTrayToolTipCloseEvent(DependencyObject target)
+ {
+ if (target == null) return null;
+
+ RoutedEventArgs args = new RoutedEventArgs();
+ args.RoutedEvent = TrayToolTipCloseEvent;
+ RoutedEventHelper.RaiseEvent(target, args);
+ return args;
+ }
+
+ ///
+ /// PreviewTrayToolTipClose Routed Event
+ ///
+ 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 PreviewTrayToolTipClose
+ {
+ add { AddHandler(PreviewTrayToolTipCloseEvent, value); }
+ remove { RemoveHandler(PreviewTrayToolTipCloseEvent, value); }
+ }
+
+ ///
+ /// A helper method to raise the PreviewTrayToolTipClose event.
+ ///
+ protected RoutedEventArgs RaisePreviewTrayToolTipCloseEvent()
+ {
+ return RaisePreviewTrayToolTipCloseEvent(this);
+ }
+
+ ///
+ /// 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 RaisePreviewTrayToolTipCloseEvent(DependencyObject target)
+ {
+ if (target == null) return null;
+
+ RoutedEventArgs args = new RoutedEventArgs();
+ args.RoutedEvent = PreviewTrayToolTipCloseEvent;
+ RoutedEventHelper.RaiseEvent(target, args);
+ return args;
+ }
+
+ #endregion
+
+ //ATTACHED EVENTS
+
+ #region PopupOpened
+
+ ///
+ /// PopupOpened Attached Routed Event
+ ///
+ public static readonly RoutedEvent PopupOpenedEvent = EventManager.RegisterRoutedEvent("PopupOpened",
+ RoutingStrategy.Bubble, typeof (RoutedEventHandler), typeof (TaskbarIcon));
+
+ ///
+ /// Adds a handler for the PopupOpened attached event
+ ///
+ /// UIElement or ContentElement that listens to the event
+ /// Event handler to be added
+ public static void AddPopupOpenedHandler(DependencyObject element, RoutedEventHandler handler)
+ {
+ RoutedEventHelper.AddHandler(element, PopupOpenedEvent, handler);
+ }
+
+ ///
+ /// Removes a handler for the PopupOpened attached event
+ ///
+ /// UIElement or ContentElement that listens to the event
+ /// Event handler to be removed
+ public static void RemovePopupOpenedHandler(DependencyObject element, RoutedEventHandler handler)
+ {
+ RoutedEventHelper.RemoveHandler(element, PopupOpenedEvent, handler);
+ }
+
+ ///
+ /// A static helper method to raise the PopupOpened event on a target element.
+ ///
+ /// UIElement or ContentElement on which to raise the event
+ internal static RoutedEventArgs RaisePopupOpenedEvent(DependencyObject target)
+ {
+ if (target == null) return null;
+
+ RoutedEventArgs args = new RoutedEventArgs();
+ args.RoutedEvent = PopupOpenedEvent;
+ RoutedEventHelper.RaiseEvent(target, args);
+ return args;
+ }
+
+ #endregion
+
+ #region ToolTipOpened
+
+ ///
+ /// ToolTipOpened Attached Routed Event
+ ///
+ public static readonly RoutedEvent ToolTipOpenedEvent = EventManager.RegisterRoutedEvent("ToolTipOpened",
+ RoutingStrategy.Bubble, typeof (RoutedEventHandler), typeof (TaskbarIcon));
+
+ ///
+ /// Adds a handler for the ToolTipOpened attached event
+ ///
+ /// UIElement or ContentElement that listens to the event
+ /// Event handler to be added
+ public static void AddToolTipOpenedHandler(DependencyObject element, RoutedEventHandler handler)
+ {
+ RoutedEventHelper.AddHandler(element, ToolTipOpenedEvent, handler);
+ }
+
+ ///
+ /// Removes a handler for the ToolTipOpened attached event
+ ///
+ /// UIElement or ContentElement that listens to the event
+ /// Event handler to be removed
+ public static void RemoveToolTipOpenedHandler(DependencyObject element, RoutedEventHandler handler)
+ {
+ RoutedEventHelper.RemoveHandler(element, ToolTipOpenedEvent, handler);
+ }
+
+ ///
+ /// A static helper method to raise the ToolTipOpened event on a target element.
+ ///
+ /// UIElement or ContentElement on which to raise the event
+ internal static RoutedEventArgs RaiseToolTipOpenedEvent(DependencyObject target)
+ {
+ if (target == null) return null;
+
+ RoutedEventArgs args = new RoutedEventArgs();
+ args.RoutedEvent = ToolTipOpenedEvent;
+ RoutedEventHelper.RaiseEvent(target, args);
+ return args;
+ }
+
+ #endregion
+
+ #region ToolTipClose
+
+ ///
+ /// ToolTipClose Attached Routed Event
+ ///
+ public static readonly RoutedEvent ToolTipCloseEvent = EventManager.RegisterRoutedEvent("ToolTipClose",
+ RoutingStrategy.Bubble, typeof (RoutedEventHandler), typeof (TaskbarIcon));
+
+ ///
+ /// Adds a handler for the ToolTipClose attached event
+ ///
+ /// UIElement or ContentElement that listens to the event
+ /// Event handler to be added
+ public static void AddToolTipCloseHandler(DependencyObject element, RoutedEventHandler handler)
+ {
+ RoutedEventHelper.AddHandler(element, ToolTipCloseEvent, handler);
+ }
+
+ ///
+ /// Removes a handler for the ToolTipClose attached event
+ ///
+ /// UIElement or ContentElement that listens to the event
+ /// Event handler to be removed
+ public static void RemoveToolTipCloseHandler(DependencyObject element, RoutedEventHandler handler)
+ {
+ RoutedEventHelper.RemoveHandler(element, ToolTipCloseEvent, handler);
+ }
+
+ ///
+ /// A static helper method to raise the ToolTipClose event on a target element.
+ ///
+ /// UIElement or ContentElement on which to raise the event
+ internal static RoutedEventArgs RaiseToolTipCloseEvent(DependencyObject target)
+ {
+ if (target == null) return null;
+
+ RoutedEventArgs args = new RoutedEventArgs();
+ args.RoutedEvent = ToolTipCloseEvent;
+ RoutedEventHelper.RaiseEvent(target, args);
+ return args;
+ }
+
+ #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
+ /// The instance that manages the balloon.
+ internal static RoutedEventArgs RaiseBalloonShowingEvent(DependencyObject target, TaskbarIcon source)
+ {
+ if (target == null) return null;
+
+ RoutedEventArgs args = new RoutedEventArgs(BalloonShowingEvent, source);
+ RoutedEventHelper.RaiseEvent(target, args);
+ return args;
+ }
+
+ #endregion
+
+ #region BalloonClosing
+
+ ///
+ /// BalloonClosing Attached Routed Event
+ ///
+ public static readonly RoutedEvent BalloonClosingEvent = EventManager.RegisterRoutedEvent("BalloonClosing",
+ RoutingStrategy.Bubble, typeof (RoutedEventHandler), typeof (TaskbarIcon));
+
+ ///
+ /// Adds a handler for the BalloonClosing attached event
+ ///
+ /// UIElement or ContentElement that listens to the event
+ /// Event handler to be added
+ public static void AddBalloonClosingHandler(DependencyObject element, RoutedEventHandler handler)
+ {
+ RoutedEventHelper.AddHandler(element, BalloonClosingEvent, handler);
+ }
+
+ ///
+ /// Removes a handler for the BalloonClosing attached event
+ ///
+ /// UIElement or ContentElement that listens to the event
+ /// Event handler to be removed
+ public static void RemoveBalloonClosingHandler(DependencyObject element, RoutedEventHandler handler)
+ {
+ RoutedEventHelper.RemoveHandler(element, BalloonClosingEvent, handler);
+ }
+
+ ///
+ /// A static helper method to raise the BalloonClosing event on a target element.
+ ///
+ /// UIElement or ContentElement on which to raise the event
+ /// The instance that manages the balloon.
+ internal static RoutedEventArgs RaiseBalloonClosingEvent(DependencyObject target, TaskbarIcon source)
+ {
+ if (target == null) return null;
+
+ RoutedEventArgs args = new RoutedEventArgs(BalloonClosingEvent, source);
+ RoutedEventHelper.RaiseEvent(target, args);
+ return args;
+ }
+
+ #endregion
+
+ //ATTACHED PROPERTIES
+
+ #region ParentTaskbarIcon
+
+ ///
+ /// An attached property that is assigned to displayed UI elements (balloos, tooltips, context menus), and
+ /// that can be used to bind to this control. The attached property is being derived, so binding is
+ /// quite straightforward:
+ ///
+ ///
+ ///
+ ///
+ public static readonly DependencyProperty ParentTaskbarIconProperty =
+ DependencyProperty.RegisterAttached("ParentTaskbarIcon", typeof (TaskbarIcon), typeof (TaskbarIcon),
+ new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.Inherits));
+
+ ///
+ /// Gets the ParentTaskbarIcon property. This dependency property
+ /// indicates ....
+ ///
+ public static TaskbarIcon GetParentTaskbarIcon(DependencyObject d)
+ {
+ return (TaskbarIcon) d.GetValue(ParentTaskbarIconProperty);
+ }
+
+ ///
+ /// Sets the ParentTaskbarIcon property. This dependency property
+ /// indicates ....
+ ///
+ public static void SetParentTaskbarIcon(DependencyObject d, TaskbarIcon value)
+ {
+ d.SetValue(ParentTaskbarIconProperty, value);
+ }
+
+ #endregion
+
+ //BASE CLASS PROPERTY OVERRIDES
+
+ ///
+ /// Registers properties.
+ ///
+ static TaskbarIcon()
+ {
+ //register change listener for the Visibility property
+ var md = new PropertyMetadata(Visibility.Visible, VisibilityPropertyChanged);
+ VisibilityProperty.OverrideMetadata(typeof (TaskbarIcon), md);
+
+ //register change listener for the DataContext property
+ md = new FrameworkPropertyMetadata(new PropertyChangedCallback(DataContextPropertyChanged));
+ DataContextProperty.OverrideMetadata(typeof (TaskbarIcon), md);
+
+ //register change listener for the ContextMenu property
+ md = new FrameworkPropertyMetadata(new PropertyChangedCallback(ContextMenuPropertyChanged));
+ ContextMenuProperty.OverrideMetadata(typeof (TaskbarIcon), md);
+ }
+ }
}
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/TaskbarIcon.cs b/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/TaskbarIcon.cs
index 0ce67de..884eedc 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/TaskbarIcon.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/TaskbarIcon.cs
@@ -1,1092 +1,1092 @@
-// hardcodet.net NotifyIcon for WPF
-// Copyright (c) 2009 - 2013 Philipp Sumi
-// Contact and Information: http://www.hardcodet.net
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the Code Project Open License (CPOL);
-// either version 1.0 of the License, or (at your option) any later
-// version.
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-//
-// THIS COPYRIGHT NOTICE MAY NOT BE REMOVED FROM THIS FILE
-
-
-using System;
-using System.Diagnostics;
-using System.Drawing;
-using System.Threading;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Controls.Primitives;
-using System.Windows.Interop;
-using System.Windows.Threading;
-using Hardcodet.Wpf.TaskbarNotification.Interop;
-using Point = Hardcodet.Wpf.TaskbarNotification.Interop.Point;
-
-
-namespace Hardcodet.Wpf.TaskbarNotification
-{
- ///
- /// A WPF proxy to for a taskbar icon (NotifyIcon) that sits in the system's
- /// taskbar notification area ("system tray").
- ///
- public partial class TaskbarIcon : FrameworkElement, IDisposable
- {
- #region Members
-
- ///
- /// Represents the current icon data.
- ///
- private NotifyIconData iconData;
-
- ///
- /// Receives messages from the taskbar icon.
- ///
- private readonly WindowMessageSink messageSink;
-
- ///
- /// An action that is being invoked if the
- /// fires.
- ///
- private Action singleClickTimerAction;
-
- ///
- /// A timer that is used to differentiate between single
- /// and double clicks.
- ///
- 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.
- ///
- public bool IsTaskbarIconCreated { get; private set; }
-
- ///
- /// Indicates whether custom tooltips are supported, which depends
- /// on the OS. Windows Vista or higher is required in order to
- /// support this feature.
- ///
- public bool SupportsCustomToolTips
- {
- 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;
- }
- }
-
- private double scalingFactor = double.NaN;
-
- #endregion
-
- #region Construction
-
- ///
- /// Inits the taskbar icon and registers a message listener
- /// in order to receive events from the taskbar area.
- ///
- public TaskbarIcon()
- {
- //using dummy sink in design mode
- messageSink = Util.IsDesignMode
- ? WindowMessageSink.CreateEmpty()
- : new WindowMessageSink(NotifyIconVersion.Win95);
-
- //init icon data structure
- iconData = NotifyIconData.CreateDefault(messageSink.MessageWindowHandle);
-
- //create the taskbar icon
- CreateTaskbarIcon();
-
- //register event listeners
- messageSink.MouseEventReceived += OnMouseEvent;
- messageSink.TaskbarCreated += OnTaskbarCreated;
- messageSink.ChangeToolTipStateRequest += OnToolTipChange;
- messageSink.BalloonToolTipChanged += OnBalloonToolTipChanged;
-
- //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;
- }
-
- #endregion
-
- #region Custom Balloons
-
- ///
- /// 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.
- /// Submit null in order to keep the balloon open inde
- ///
- /// If
- /// is a null reference.
- public void ShowCustomBalloon(UIElement balloon, PopupAnimation animation, int? timeout)
- {
- Dispatcher dispatcher = this.GetDispatcher();
- if (!dispatcher.CheckAccess())
- {
- var action = new Action(() => ShowCustomBalloon(balloon, animation, timeout));
- dispatcher.Invoke(DispatcherPriority.Normal, action);
- return;
- }
-
- 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;
-
- //provide the popup with the taskbar icon's data context
- UpdateDataContext(popup, null, DataContext);
-
- //don't animate by default - devs can use attached
- //events or override
- popup.PopupAnimation = animation;
-
- //in case the balloon is cleaned up through routed events, the
- //control didn't remove the balloon from its parent popup when
- //if was closed the last time - just make sure it doesn't have
- //a parent that is a popup
- var parent = LogicalTreeHelper.GetParent(balloon) as Popup;
- if (parent != null) parent.Child = null;
-
- if (parent != null)
- {
- string msg =
- "Cannot display control [{0}] in a new balloon popup - that control already has a parent. You may consider creating new balloons every time you want to show one.";
- msg = String.Format(msg, balloon);
- throw new InvalidOperationException(msg);
- }
-
- popup.Child = balloon;
-
- //don't set the PlacementTarget as it causes the popup to become hidden if the
- //TaskbarIcon's parent is hidden, too...
- //popup.PlacementTarget = this;
-
- popup.Placement = PlacementMode.AbsolutePoint;
- popup.StaysOpen = true;
-
- Point position = TrayInfo.GetTrayLocation();
- position = GetDeviceCoordinates(position);
- popup.HorizontalOffset = position.X - 1;
- popup.VerticalOffset = position.Y - 1;
-
- //store reference
- lock (this)
- {
- SetCustomBalloon(popup);
- }
-
- //assign this instance as an attached property
- SetParentTaskbarIcon(balloon, this);
-
- //fire attached event
- RaiseBalloonShowingEvent(balloon, this);
-
- //display item
- popup.IsOpen = true;
-
- if (timeout.HasValue)
- {
- //register timer to close the popup
- balloonCloseTimer.Change(timeout.Value, Timeout.Infinite);
- }
- }
-
-
- ///
- /// Resets the closing timeout, which effectively
- /// keeps a displayed balloon message open until
- /// it is either closed programmatically through
- /// or due to a new
- /// message being displayed.
- ///
- public void ResetBalloonCloseTimer()
- {
- if (IsDisposed) return;
-
- lock (this)
- {
- //reset timer in any case
- balloonCloseTimer.Change(Timeout.Infinite, Timeout.Infinite);
- }
- }
-
-
- ///
- /// Closes the current , if the
- /// property is set.
- ///
- public void CloseBalloon()
- {
- if (IsDisposed) return;
-
- Dispatcher dispatcher = this.GetDispatcher();
- if (!dispatcher.CheckAccess())
- {
- Action action = CloseBalloon;
- dispatcher.Invoke(DispatcherPriority.Normal, action);
- 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)
- {
- UIElement element = popup.Child;
-
- //announce closing
- RoutedEventArgs eventArgs = RaiseBalloonClosingEvent(element, this);
- if (!eventArgs.Handled)
- {
- //if the event was handled, clear the reference to the popup,
- //but don't close it - the handling code has to manage this stuff now
-
- //close the popup
- popup.IsOpen = false;
-
- //remove the reference of the popup to the balloon in case we want to reuse
- //the balloon (then added to a new popup)
- popup.Child = null;
-
- //reset attached property
- if (element != null) SetParentTaskbarIcon(element, null);
- }
-
- //remove custom balloon anyway
- 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;
- this.GetDispatcher().Invoke(action);
- }
-
- #endregion
-
- #region Process Incoming Mouse Events
-
- ///
- /// Processes mouse events, which are bubbled
- /// through the class' routed events, trigger
- /// certain actions (e.g. show a popup), or
- /// both.
- ///
- /// Event flag.
- private void OnMouseEvent(MouseEvent me)
- {
- if (IsDisposed) return;
-
- switch (me)
- {
- case MouseEvent.MouseMove:
- RaiseTrayMouseMoveEvent();
- //immediately return - there's nothing left to evaluate
- return;
- case MouseEvent.IconRightMouseDown:
- RaiseTrayRightMouseDownEvent();
- break;
- case MouseEvent.IconLeftMouseDown:
- RaiseTrayLeftMouseDownEvent();
- break;
- case MouseEvent.IconRightMouseUp:
- RaiseTrayRightMouseUpEvent();
- break;
- case MouseEvent.IconLeftMouseUp:
- RaiseTrayLeftMouseUpEvent();
- break;
- case MouseEvent.IconMiddleMouseDown:
- RaiseTrayMiddleMouseDownEvent();
- break;
- case MouseEvent.IconMiddleMouseUp:
- RaiseTrayMiddleMouseUpEvent();
- break;
- case MouseEvent.IconDoubleClick:
- //cancel single click timer
- singleClickTimer.Change(Timeout.Infinite, Timeout.Infinite);
- //bubble event
- RaiseTrayMouseDoubleClickEvent();
- break;
- case MouseEvent.BalloonToolTipClicked:
- RaiseTrayBalloonTipClickedEvent();
- break;
- default:
- throw new ArgumentOutOfRangeException("me", "Missing handler for mouse event flag: " + me);
- }
-
-
- //get mouse coordinates
- Point cursorPosition = new Point();
- if (messageSink.Version == NotifyIconVersion.Vista)
- {
- //physical cursor position is supported for Vista and above
- WinApi.GetPhysicalCursorPos(ref cursorPosition);
- }
- else
- {
- WinApi.GetCursorPos(ref cursorPosition);
- }
-
- cursorPosition = GetDeviceCoordinates(cursorPosition);
-
- bool isLeftClickCommandInvoked = false;
-
- //show popup, if requested
- if (me.IsMatch(PopupActivation))
- {
- if (me == MouseEvent.IconLeftMouseUp)
- {
- //show popup once we are sure it's not a double click
- singleClickTimerAction = () =>
- {
- LeftClickCommand.ExecuteIfEnabled(LeftClickCommandParameter, LeftClickCommandTarget ?? this);
- ShowTrayPopup(cursorPosition);
- };
- singleClickTimer.Change(WinApi.GetDoubleClickTime(), Timeout.Infinite);
- isLeftClickCommandInvoked = true;
- }
- else
- {
- //show popup immediately
- ShowTrayPopup(cursorPosition);
- }
- }
-
-
- //show context menu, if requested
- if (me.IsMatch(MenuActivation))
- {
- if (me == MouseEvent.IconLeftMouseUp)
- {
- //show context menu once we are sure it's not a double click
- singleClickTimerAction = () =>
- {
- LeftClickCommand.ExecuteIfEnabled(LeftClickCommandParameter, LeftClickCommandTarget ?? this);
- ShowContextMenu(cursorPosition);
- };
- singleClickTimer.Change(WinApi.GetDoubleClickTime(), Timeout.Infinite);
- isLeftClickCommandInvoked = true;
- }
- else
- {
- //show context menu immediately
- ShowContextMenu(cursorPosition);
- }
- }
-
- //make sure the left click command is invoked on mouse clicks
- if (me == MouseEvent.IconLeftMouseUp && !isLeftClickCommandInvoked)
- {
- //show context menu once we are sure it's not a double click
- singleClickTimerAction =
- () =>
- {
- LeftClickCommand.ExecuteIfEnabled(LeftClickCommandParameter, LeftClickCommandTarget ?? this);
- };
- singleClickTimer.Change(WinApi.GetDoubleClickTime(), Timeout.Infinite);
- }
- }
-
- #endregion
-
- #region ToolTips
-
- ///
- /// Displays a custom tooltip, if available. This method is only
- /// invoked for Windows Vista and above.
- ///
- /// Whether to show or hide the tooltip.
- private void OnToolTipChange(bool visible)
- {
- //if we don't have a tooltip, there's nothing to do here...
- if (TrayToolTipResolved == null) return;
-
- if (visible)
- {
- if (IsPopupOpen)
- {
- //ignore if we are already displaying something down there
- return;
- }
-
- var args = RaisePreviewTrayToolTipOpenEvent();
- if (args.Handled) return;
-
- TrayToolTipResolved.IsOpen = true;
-
- //raise attached event first
- if (TrayToolTip != null) RaiseToolTipOpenedEvent(TrayToolTip);
-
- //bubble routed event
- RaiseTrayToolTipOpenEvent();
- }
- else
- {
- var args = RaisePreviewTrayToolTipCloseEvent();
- if (args.Handled) return;
-
- //raise attached event first
- if (TrayToolTip != null) RaiseToolTipCloseEvent(TrayToolTip);
-
- TrayToolTipResolved.IsOpen = false;
-
- //bubble event
- RaiseTrayToolTipCloseEvent();
- }
- }
-
-
- ///
- /// Creates a control that either
- /// wraps the currently set
- /// control or the string.
- /// If itself is already
- /// a instance, it will be used directly.
- ///
- /// We use a rather than
- /// 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
- /// property which prevents this issue.
- private void CreateCustomToolTip()
- {
- //check if the item itself is a tooltip
- ToolTip tt = TrayToolTip as ToolTip;
-
- if (tt == null && TrayToolTip != null)
- {
- //create an invisible wrapper tooltip that hosts the UIElement
- tt = new ToolTip();
- tt.Placement = PlacementMode.Mouse;
-
- //do *not* set the placement target, as it causes the popup to become hidden if the
- //TaskbarIcon's parent is hidden, too. At runtime, the parent can be resolved through
- //the ParentTaskbarIcon attached dependency property:
- //tt.PlacementTarget = this;
-
- //make sure the tooltip is invisible
- tt.HasDropShadow = false;
- tt.BorderThickness = new Thickness(0);
- tt.Background = System.Windows.Media.Brushes.Transparent;
-
- //setting the
- tt.StaysOpen = true;
- tt.Content = TrayToolTip;
- }
- else if (tt == null && !String.IsNullOrEmpty(ToolTipText))
- {
- //create a simple tooltip for the ToolTipText string
- tt = new ToolTip();
- tt.Content = ToolTipText;
- }
-
- //the tooltip explicitly gets the DataContext of this instance.
- //If there is no DataContext, the TaskbarIcon assigns itself
- if (tt != null)
- {
- UpdateDataContext(tt, null, DataContext);
- }
-
- //store a reference to the used tooltip
- SetTrayToolTipResolved(tt);
- }
-
-
- ///
- /// Sets tooltip settings for the class depending on defined
- /// dependency properties and OS support.
- ///
- private void WriteToolTipSettings()
- {
- const IconDataMembers flags = IconDataMembers.Tip;
- iconData.ToolTipText = ToolTipText;
-
- if (messageSink.Version == NotifyIconVersion.Vista)
- {
- //we need to set a tooltip text to get tooltip events from the
- //taskbar icon
- 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)
- iconData.ToolTipText = "ToolTip";
- }
- }
-
- //update the tooltip text
- Util.WriteIconData(ref iconData, NotifyCommand.Modify, flags);
- }
-
- #endregion
-
- #region Custom Popup
-
- ///
- /// Creates a control that either
- /// wraps the currently set
- /// control or the string.
- /// If itself is already
- /// a instance, it will be used directly.
- ///
- /// We use a rather than
- /// 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
- /// property which prevents this issue.
- private void CreatePopup()
- {
- //check if the item itself is a popup
- Popup popup = TrayPopup as Popup;
-
- if (popup == null && TrayPopup != null)
- {
- //create an invisible popup that hosts the UIElement
- popup = new Popup();
- popup.AllowsTransparency = true;
-
- //don't animate by default - devs can use attached
- //events or override
- popup.PopupAnimation = PopupAnimation.None;
-
- //the CreateRootPopup method outputs binding errors in the debug window because
- //it tries to bind to "Popup-specific" properties in case they are provided by the child.
- //We don't need that so just assign the control as the child.
- popup.Child = TrayPopup;
-
- //do *not* set the placement target, as it causes the popup to become hidden if the
- //TaskbarIcon's parent is hidden, too. At runtime, the parent can be resolved through
- //the ParentTaskbarIcon attached dependency property:
- //popup.PlacementTarget = this;
-
- popup.Placement = PlacementMode.AbsolutePoint;
- popup.StaysOpen = false;
- }
-
- //the popup explicitly gets the DataContext of this instance.
- //If there is no DataContext, the TaskbarIcon assigns itself
- if (popup != null)
- {
- UpdateDataContext(popup, null, DataContext);
- }
-
- //store a reference to the used tooltip
- SetTrayPopupResolved(popup);
- }
-
-
- ///
- /// Displays the control if
- /// it was set.
- ///
- private void ShowTrayPopup(Point cursorPosition)
- {
- if (IsDisposed) return;
-
- //raise preview event no matter whether popup is currently set
- //or not (enables client to set it on demand)
- var args = RaisePreviewTrayPopupOpenEvent();
- if (args.Handled) return;
-
- if (TrayPopup != null)
- {
- //use absolute position, but place the popup centered above the icon
- TrayPopupResolved.Placement = PlacementMode.AbsolutePoint;
- TrayPopupResolved.HorizontalOffset = cursorPosition.X;
- TrayPopupResolved.VerticalOffset = cursorPosition.Y;
-
- //open popup
- TrayPopupResolved.IsOpen = true;
-
- IntPtr handle = IntPtr.Zero;
- if (TrayPopupResolved.Child != null)
- {
- //try to get a handle on the popup itself (via its child)
- HwndSource source = (HwndSource) PresentationSource.FromVisual(TrayPopupResolved.Child);
- if (source != null) handle = source.Handle;
- }
-
- //if we don't have a handle for the popup, fall back to the message sink
- if (handle == IntPtr.Zero) handle = messageSink.MessageWindowHandle;
-
- //activate either popup or message sink to track deactivation.
- //otherwise, the popup does not close if the user clicks somewhere else
- WinApi.SetForegroundWindow(handle);
-
- //raise attached event - item should never be null unless developers
- //changed the CustomPopup directly...
- if (TrayPopup != null) RaisePopupOpenedEvent(TrayPopup);
-
- //bubble routed event
- RaiseTrayPopupOpenEvent();
- }
- }
-
- #endregion
-
- #region Context Menu
-
- ///
- /// Displays the if
- /// it was set.
- ///
- private void ShowContextMenu(Point cursorPosition)
- {
- if (IsDisposed) return;
-
- //raise preview event no matter whether context menu is currently set
- //or not (enables client to set it on demand)
- var args = RaisePreviewTrayContextMenuOpenEvent();
- if (args.Handled) return;
-
- if (ContextMenu != null)
- {
- //use absolute positioning. We need to set the coordinates, or a delayed opening
- //(e.g. when left-clicked) opens the context menu at the wrong place if the mouse
- //is moved!
- ContextMenu.Placement = PlacementMode.AbsolutePoint;
- ContextMenu.HorizontalOffset = cursorPosition.X;
- ContextMenu.VerticalOffset = cursorPosition.Y;
- ContextMenu.IsOpen = true;
-
- IntPtr handle = IntPtr.Zero;
-
- //try to get a handle on the context itself
- HwndSource source = (HwndSource) PresentationSource.FromVisual(ContextMenu);
- if (source != null)
- {
- handle = source.Handle;
- }
-
- //if we don't have a handle for the popup, fall back to the message sink
- if (handle == IntPtr.Zero) handle = messageSink.MessageWindowHandle;
-
- //activate the context menu or the message window to track deactivation - otherwise, the context menu
- //does not close if the user clicks somewhere else. With the message window
- //fallback, the context menu can't receive keyboard events - should not happen though
- WinApi.SetForegroundWindow(handle);
-
- //bubble event
- RaiseTrayContextMenuOpenEvent();
- }
- }
-
- #endregion
-
- #region Balloon Tips
-
- ///
- /// Bubbles events if a balloon ToolTip was displayed
- /// or removed.
- ///
- /// Whether the ToolTip was just displayed
- /// or removed.
- private void OnBalloonToolTipChanged(bool visible)
- {
- if (visible)
- {
- RaiseTrayBalloonTipShownEvent();
- }
- else
- {
- RaiseTrayBalloonTipClosedEvent();
- }
- }
-
- ///
- /// Displays a balloon tip with the specified title,
- /// text, and icon in the taskbar for the specified time period.
- ///
- /// The title to display on the balloon tip.
- /// The text to display on the balloon tip.
- /// A symbol that indicates the severity.
- public void ShowBalloonTip(string title, string message, BalloonIcon symbol)
- {
- lock (this)
- {
- ShowBalloonTip(title, message, symbol.GetBalloonFlag(), IntPtr.Zero);
- }
- }
-
-
- ///
- /// Displays a balloon tip with the specified title,
- /// text, and a custom icon in the taskbar for the specified time period.
- ///
- /// The title to display on the balloon tip.
- /// The text to display on the balloon tip.
- /// A custom icon.
- /// If
- /// is a null reference.
- public void ShowBalloonTip(string title, string message, Icon customIcon)
- {
- if (customIcon == null) throw new ArgumentNullException("customIcon");
-
- lock (this)
- {
- ShowBalloonTip(title, message, BalloonFlags.User, customIcon.Handle);
- }
- }
-
-
- ///
- /// Invokes in order to display
- /// a given balloon ToolTip.
- ///
- /// The title to display on the balloon tip.
- /// The text to display on the balloon tip.
- /// Indicates what icon to use.
- /// A handle to a custom icon, if any, or
- /// .
- private void ShowBalloonTip(string title, string message, BalloonFlags flags, IntPtr balloonIconHandle)
- {
- EnsureNotDisposed();
-
- iconData.BalloonText = message ?? String.Empty;
- iconData.BalloonTitle = title ?? String.Empty;
-
- iconData.BalloonFlags = flags;
- iconData.CustomBalloonIconHandle = balloonIconHandle;
- Util.WriteIconData(ref iconData, NotifyCommand.Modify, IconDataMembers.Info | IconDataMembers.Icon);
- }
-
-
- ///
- /// Hides a balloon ToolTip, if any is displayed.
- ///
- public void HideBalloonTip()
- {
- EnsureNotDisposed();
-
- //reset balloon by just setting the info to an empty string
- iconData.BalloonText = iconData.BalloonTitle = String.Empty;
- Util.WriteIconData(ref iconData, NotifyCommand.Modify, IconDataMembers.Info);
- }
-
- #endregion
-
- #region Single Click Timer event
-
- ///
- /// 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 .
- ///
- private void DoSingleClickAction(object state)
- {
- if (IsDisposed) return;
-
- //run action
- Action action = singleClickTimerAction;
- if (action != null)
- {
- //cleanup action
- singleClickTimerAction = null;
-
- //switch to UI thread
- this.GetDispatcher().Invoke(action);
- }
- }
-
- #endregion
-
- #region Set Version (API)
-
- ///
- /// Sets the version flag for the .
- ///
- private void SetVersion()
- {
- iconData.VersionOrTimeout = (uint) NotifyIconVersion.Vista;
- bool status = WinApi.Shell_NotifyIcon(NotifyCommand.SetVersion, ref iconData);
-
- if (!status)
- {
- iconData.VersionOrTimeout = (uint) NotifyIconVersion.Win2000;
- status = Util.WriteIconData(ref iconData, NotifyCommand.SetVersion);
- }
-
- if (!status)
- {
- iconData.VersionOrTimeout = (uint) NotifyIconVersion.Win95;
- status = Util.WriteIconData(ref iconData, NotifyCommand.SetVersion);
- }
-
- if (!status)
- {
- Debug.Fail("Could not set version");
- }
- }
-
- #endregion
-
- #region Create / Remove Taskbar Icon
-
- ///
- /// Recreates the taskbar icon if the whole taskbar was
- /// recreated (e.g. because Explorer was shut down).
- ///
- private void OnTaskbarCreated()
- {
- IsTaskbarIconCreated = false;
- CreateTaskbarIcon();
- }
-
-
- ///
- /// Creates the taskbar icon. This message is invoked during initialization,
- /// if the taskbar is restarted, and whenever the icon is displayed.
- ///
- private void CreateTaskbarIcon()
- {
- lock (this)
- {
- if (!IsTaskbarIconCreated)
- {
- const IconDataMembers members = IconDataMembers.Message
- | IconDataMembers.Icon
- | IconDataMembers.Tip;
-
- //write initial configuration
- var status = Util.WriteIconData(ref iconData, NotifyCommand.Add, members);
- if (!status)
- {
- //couldn't create the icon - we can assume this is because explorer is not running (yet!)
- //-> try a bit later again rather than throwing an exception. Typically, if the windows
- // shell is being loaded later, this method is being reinvoked from OnTaskbarCreated
- // (we could also retry after a delay, but that's currently YAGNI)
- return;
- }
-
- //set to most recent version
- SetVersion();
- messageSink.Version = (NotifyIconVersion) iconData.VersionOrTimeout;
-
- IsTaskbarIconCreated = true;
- }
- }
- }
-
- ///
- /// Closes the taskbar icon if required.
- ///
- private void RemoveTaskbarIcon()
- {
- lock (this)
- {
- //make sure we didn't schedule a creation
-
- if (IsTaskbarIconCreated)
- {
- Util.WriteIconData(ref iconData, NotifyCommand.Delete, IconDataMembers.Message);
- IsTaskbarIconCreated = false;
- }
- }
- }
-
- #endregion
-
- ///
- /// Recalculates OS coordinates in order to support WPFs coordinate
- /// system if OS scaling (DPIs) is not 100%.
- ///
- ///
- ///
- private Point GetDeviceCoordinates(Point point)
- {
- if (double.IsNaN(scalingFactor))
- {
- //calculate scaling factor in order to support non-standard DPIs
- var presentationSource = PresentationSource.FromVisual(this);
- if (presentationSource == null)
- {
- scalingFactor = 1;
- }
- else
- {
- var transform = presentationSource.CompositionTarget.TransformToDevice;
- scalingFactor = 1/transform.M11;
- }
- }
-
- //on standard DPI settings, just return the point
- if (scalingFactor == 1.0) return point;
-
- return new Point() {X = (int) (point.X*scalingFactor), Y = (int) (point.Y*scalingFactor)};
- }
-
- #region Dispose / Exit
-
- ///
- /// Set to true as soon as Dispose has been invoked.
- ///
- public bool IsDisposed { get; private set; }
-
-
- ///
- /// Checks if the object has been disposed and
- /// raises a in case
- /// the flag is true.
- ///
- private void EnsureNotDisposed()
- {
- if (IsDisposed) throw new ObjectDisposedException(Name ?? GetType().FullName);
- }
-
-
- ///
- /// Disposes the class if the application exits.
- ///
- private void OnExit(object sender, EventArgs e)
- {
- Dispose();
- }
-
-
- ///
- /// This destructor will run only if the
- /// method does not get called. This gives this base class the
- /// opportunity to finalize.
- ///
- /// Important: Do not provide destructors in types derived from
- /// this class.
- ///
- ///
- ~TaskbarIcon()
- {
- Dispose(false);
- }
-
-
- ///
- /// Disposes the object.
- ///
- /// This method is not virtual by design. Derived classes
- /// should override .
- ///
- public void Dispose()
- {
- Dispose(true);
-
- // This object will be cleaned up by the Dispose method.
- // Therefore, you should call GC.SupressFinalize to
- // take this object off the finalization queue
- // and prevent finalization code for this object
- // from executing a second time.
- GC.SuppressFinalize(this);
- }
-
-
- ///
- /// 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.
- ///
- /// If disposing equals false, the method
- /// has been called by the runtime from inside the finalizer and you
- /// should not reference other objects. Only unmanaged resources can
- /// be disposed.
- /// Check the property to determine whether
- /// the method has already been called.
- private void Dispose(bool disposing)
- {
- //don't do anything if the component is already disposed
- if (IsDisposed || !disposing) return;
-
- lock (this)
- {
- IsDisposed = true;
-
- //deregister application event listener
- if (Application.Current != null)
- {
- Application.Current.Exit -= OnExit;
- }
-
- //stop timers
- singleClickTimer.Dispose();
- balloonCloseTimer.Dispose();
-
- //dispose message sink
- messageSink.Dispose();
-
- //remove icon
- RemoveTaskbarIcon();
- }
- }
-
- #endregion
- }
+// hardcodet.net NotifyIcon for WPF
+// Copyright (c) 2009 - 2013 Philipp Sumi
+// Contact and Information: http://www.hardcodet.net
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the Code Project Open License (CPOL);
+// either version 1.0 of the License, or (at your option) any later
+// version.
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+//
+// THIS COPYRIGHT NOTICE MAY NOT BE REMOVED FROM THIS FILE
+
+
+using System;
+using System.Diagnostics;
+using System.Drawing;
+using System.Threading;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Interop;
+using System.Windows.Threading;
+using Hardcodet.Wpf.TaskbarNotification.Interop;
+using Point = Hardcodet.Wpf.TaskbarNotification.Interop.Point;
+
+
+namespace Hardcodet.Wpf.TaskbarNotification
+{
+ ///
+ /// A WPF proxy to for a taskbar icon (NotifyIcon) that sits in the system's
+ /// taskbar notification area ("system tray").
+ ///
+ public partial class TaskbarIcon : FrameworkElement, IDisposable
+ {
+ #region Members
+
+ ///
+ /// Represents the current icon data.
+ ///
+ private NotifyIconData iconData;
+
+ ///
+ /// Receives messages from the taskbar icon.
+ ///
+ private readonly WindowMessageSink messageSink;
+
+ ///
+ /// An action that is being invoked if the
+ /// fires.
+ ///
+ private Action singleClickTimerAction;
+
+ ///
+ /// A timer that is used to differentiate between single
+ /// and double clicks.
+ ///
+ 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.
+ ///
+ public bool IsTaskbarIconCreated { get; private set; }
+
+ ///
+ /// Indicates whether custom tooltips are supported, which depends
+ /// on the OS. Windows Vista or higher is required in order to
+ /// support this feature.
+ ///
+ public bool SupportsCustomToolTips
+ {
+ 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;
+ }
+ }
+
+ private double scalingFactor = double.NaN;
+
+ #endregion
+
+ #region Construction
+
+ ///
+ /// Inits the taskbar icon and registers a message listener
+ /// in order to receive events from the taskbar area.
+ ///
+ public TaskbarIcon()
+ {
+ //using dummy sink in design mode
+ messageSink = Util.IsDesignMode
+ ? WindowMessageSink.CreateEmpty()
+ : new WindowMessageSink(NotifyIconVersion.Win95);
+
+ //init icon data structure
+ iconData = NotifyIconData.CreateDefault(messageSink.MessageWindowHandle);
+
+ //create the taskbar icon
+ CreateTaskbarIcon();
+
+ //register event listeners
+ messageSink.MouseEventReceived += OnMouseEvent;
+ messageSink.TaskbarCreated += OnTaskbarCreated;
+ messageSink.ChangeToolTipStateRequest += OnToolTipChange;
+ messageSink.BalloonToolTipChanged += OnBalloonToolTipChanged;
+
+ //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;
+ }
+
+ #endregion
+
+ #region Custom Balloons
+
+ ///
+ /// 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.
+ /// Submit null in order to keep the balloon open inde
+ ///
+ /// If
+ /// is a null reference.
+ public void ShowCustomBalloon(UIElement balloon, PopupAnimation animation, int? timeout)
+ {
+ Dispatcher dispatcher = this.GetDispatcher();
+ if (!dispatcher.CheckAccess())
+ {
+ var action = new Action(() => ShowCustomBalloon(balloon, animation, timeout));
+ dispatcher.Invoke(DispatcherPriority.Normal, action);
+ return;
+ }
+
+ 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;
+
+ //provide the popup with the taskbar icon's data context
+ UpdateDataContext(popup, null, DataContext);
+
+ //don't animate by default - devs can use attached
+ //events or override
+ popup.PopupAnimation = animation;
+
+ //in case the balloon is cleaned up through routed events, the
+ //control didn't remove the balloon from its parent popup when
+ //if was closed the last time - just make sure it doesn't have
+ //a parent that is a popup
+ var parent = LogicalTreeHelper.GetParent(balloon) as Popup;
+ if (parent != null) parent.Child = null;
+
+ if (parent != null)
+ {
+ string msg =
+ "Cannot display control [{0}] in a new balloon popup - that control already has a parent. You may consider creating new balloons every time you want to show one.";
+ msg = String.Format(msg, balloon);
+ throw new InvalidOperationException(msg);
+ }
+
+ popup.Child = balloon;
+
+ //don't set the PlacementTarget as it causes the popup to become hidden if the
+ //TaskbarIcon's parent is hidden, too...
+ //popup.PlacementTarget = this;
+
+ popup.Placement = PlacementMode.AbsolutePoint;
+ popup.StaysOpen = true;
+
+ Point position = TrayInfo.GetTrayLocation();
+ position = GetDeviceCoordinates(position);
+ popup.HorizontalOffset = position.X - 1;
+ popup.VerticalOffset = position.Y - 1;
+
+ //store reference
+ lock (this)
+ {
+ SetCustomBalloon(popup);
+ }
+
+ //assign this instance as an attached property
+ SetParentTaskbarIcon(balloon, this);
+
+ //fire attached event
+ RaiseBalloonShowingEvent(balloon, this);
+
+ //display item
+ popup.IsOpen = true;
+
+ if (timeout.HasValue)
+ {
+ //register timer to close the popup
+ balloonCloseTimer.Change(timeout.Value, Timeout.Infinite);
+ }
+ }
+
+
+ ///
+ /// Resets the closing timeout, which effectively
+ /// keeps a displayed balloon message open until
+ /// it is either closed programmatically through
+ /// or due to a new
+ /// message being displayed.
+ ///
+ public void ResetBalloonCloseTimer()
+ {
+ if (IsDisposed) return;
+
+ lock (this)
+ {
+ //reset timer in any case
+ balloonCloseTimer.Change(Timeout.Infinite, Timeout.Infinite);
+ }
+ }
+
+
+ ///
+ /// Closes the current , if the
+ /// property is set.
+ ///
+ public void CloseBalloon()
+ {
+ if (IsDisposed) return;
+
+ Dispatcher dispatcher = this.GetDispatcher();
+ if (!dispatcher.CheckAccess())
+ {
+ Action action = CloseBalloon;
+ dispatcher.Invoke(DispatcherPriority.Normal, action);
+ 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)
+ {
+ UIElement element = popup.Child;
+
+ //announce closing
+ RoutedEventArgs eventArgs = RaiseBalloonClosingEvent(element, this);
+ if (!eventArgs.Handled)
+ {
+ //if the event was handled, clear the reference to the popup,
+ //but don't close it - the handling code has to manage this stuff now
+
+ //close the popup
+ popup.IsOpen = false;
+
+ //remove the reference of the popup to the balloon in case we want to reuse
+ //the balloon (then added to a new popup)
+ popup.Child = null;
+
+ //reset attached property
+ if (element != null) SetParentTaskbarIcon(element, null);
+ }
+
+ //remove custom balloon anyway
+ 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;
+ this.GetDispatcher().Invoke(action);
+ }
+
+ #endregion
+
+ #region Process Incoming Mouse Events
+
+ ///
+ /// Processes mouse events, which are bubbled
+ /// through the class' routed events, trigger
+ /// certain actions (e.g. show a popup), or
+ /// both.
+ ///
+ /// Event flag.
+ private void OnMouseEvent(MouseEvent me)
+ {
+ if (IsDisposed) return;
+
+ switch (me)
+ {
+ case MouseEvent.MouseMove:
+ RaiseTrayMouseMoveEvent();
+ //immediately return - there's nothing left to evaluate
+ return;
+ case MouseEvent.IconRightMouseDown:
+ RaiseTrayRightMouseDownEvent();
+ break;
+ case MouseEvent.IconLeftMouseDown:
+ RaiseTrayLeftMouseDownEvent();
+ break;
+ case MouseEvent.IconRightMouseUp:
+ RaiseTrayRightMouseUpEvent();
+ break;
+ case MouseEvent.IconLeftMouseUp:
+ RaiseTrayLeftMouseUpEvent();
+ break;
+ case MouseEvent.IconMiddleMouseDown:
+ RaiseTrayMiddleMouseDownEvent();
+ break;
+ case MouseEvent.IconMiddleMouseUp:
+ RaiseTrayMiddleMouseUpEvent();
+ break;
+ case MouseEvent.IconDoubleClick:
+ //cancel single click timer
+ singleClickTimer.Change(Timeout.Infinite, Timeout.Infinite);
+ //bubble event
+ RaiseTrayMouseDoubleClickEvent();
+ break;
+ case MouseEvent.BalloonToolTipClicked:
+ RaiseTrayBalloonTipClickedEvent();
+ break;
+ default:
+ throw new ArgumentOutOfRangeException("me", "Missing handler for mouse event flag: " + me);
+ }
+
+
+ //get mouse coordinates
+ Point cursorPosition = new Point();
+ if (messageSink.Version == NotifyIconVersion.Vista)
+ {
+ //physical cursor position is supported for Vista and above
+ WinApi.GetPhysicalCursorPos(ref cursorPosition);
+ }
+ else
+ {
+ WinApi.GetCursorPos(ref cursorPosition);
+ }
+
+ cursorPosition = GetDeviceCoordinates(cursorPosition);
+
+ bool isLeftClickCommandInvoked = false;
+
+ //show popup, if requested
+ if (me.IsMatch(PopupActivation))
+ {
+ if (me == MouseEvent.IconLeftMouseUp)
+ {
+ //show popup once we are sure it's not a double click
+ singleClickTimerAction = () =>
+ {
+ LeftClickCommand.ExecuteIfEnabled(LeftClickCommandParameter, LeftClickCommandTarget ?? this);
+ ShowTrayPopup(cursorPosition);
+ };
+ singleClickTimer.Change(WinApi.GetDoubleClickTime(), Timeout.Infinite);
+ isLeftClickCommandInvoked = true;
+ }
+ else
+ {
+ //show popup immediately
+ ShowTrayPopup(cursorPosition);
+ }
+ }
+
+
+ //show context menu, if requested
+ if (me.IsMatch(MenuActivation))
+ {
+ if (me == MouseEvent.IconLeftMouseUp)
+ {
+ //show context menu once we are sure it's not a double click
+ singleClickTimerAction = () =>
+ {
+ LeftClickCommand.ExecuteIfEnabled(LeftClickCommandParameter, LeftClickCommandTarget ?? this);
+ ShowContextMenu(cursorPosition);
+ };
+ singleClickTimer.Change(WinApi.GetDoubleClickTime(), Timeout.Infinite);
+ isLeftClickCommandInvoked = true;
+ }
+ else
+ {
+ //show context menu immediately
+ ShowContextMenu(cursorPosition);
+ }
+ }
+
+ //make sure the left click command is invoked on mouse clicks
+ if (me == MouseEvent.IconLeftMouseUp && !isLeftClickCommandInvoked)
+ {
+ //show context menu once we are sure it's not a double click
+ singleClickTimerAction =
+ () =>
+ {
+ LeftClickCommand.ExecuteIfEnabled(LeftClickCommandParameter, LeftClickCommandTarget ?? this);
+ };
+ singleClickTimer.Change(WinApi.GetDoubleClickTime(), Timeout.Infinite);
+ }
+ }
+
+ #endregion
+
+ #region ToolTips
+
+ ///
+ /// Displays a custom tooltip, if available. This method is only
+ /// invoked for Windows Vista and above.
+ ///
+ /// Whether to show or hide the tooltip.
+ private void OnToolTipChange(bool visible)
+ {
+ //if we don't have a tooltip, there's nothing to do here...
+ if (TrayToolTipResolved == null) return;
+
+ if (visible)
+ {
+ if (IsPopupOpen)
+ {
+ //ignore if we are already displaying something down there
+ return;
+ }
+
+ var args = RaisePreviewTrayToolTipOpenEvent();
+ if (args.Handled) return;
+
+ TrayToolTipResolved.IsOpen = true;
+
+ //raise attached event first
+ if (TrayToolTip != null) RaiseToolTipOpenedEvent(TrayToolTip);
+
+ //bubble routed event
+ RaiseTrayToolTipOpenEvent();
+ }
+ else
+ {
+ var args = RaisePreviewTrayToolTipCloseEvent();
+ if (args.Handled) return;
+
+ //raise attached event first
+ if (TrayToolTip != null) RaiseToolTipCloseEvent(TrayToolTip);
+
+ TrayToolTipResolved.IsOpen = false;
+
+ //bubble event
+ RaiseTrayToolTipCloseEvent();
+ }
+ }
+
+
+ ///
+ /// Creates a control that either
+ /// wraps the currently set
+ /// control or the string.
+ /// If itself is already
+ /// a instance, it will be used directly.
+ ///
+ /// We use a rather than
+ /// 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
+ /// property which prevents this issue.
+ private void CreateCustomToolTip()
+ {
+ //check if the item itself is a tooltip
+ ToolTip tt = TrayToolTip as ToolTip;
+
+ if (tt == null && TrayToolTip != null)
+ {
+ //create an invisible wrapper tooltip that hosts the UIElement
+ tt = new ToolTip();
+ tt.Placement = PlacementMode.Mouse;
+
+ //do *not* set the placement target, as it causes the popup to become hidden if the
+ //TaskbarIcon's parent is hidden, too. At runtime, the parent can be resolved through
+ //the ParentTaskbarIcon attached dependency property:
+ //tt.PlacementTarget = this;
+
+ //make sure the tooltip is invisible
+ tt.HasDropShadow = false;
+ tt.BorderThickness = new Thickness(0);
+ tt.Background = System.Windows.Media.Brushes.Transparent;
+
+ //setting the
+ tt.StaysOpen = true;
+ tt.Content = TrayToolTip;
+ }
+ else if (tt == null && !String.IsNullOrEmpty(ToolTipText))
+ {
+ //create a simple tooltip for the ToolTipText string
+ tt = new ToolTip();
+ tt.Content = ToolTipText;
+ }
+
+ //the tooltip explicitly gets the DataContext of this instance.
+ //If there is no DataContext, the TaskbarIcon assigns itself
+ if (tt != null)
+ {
+ UpdateDataContext(tt, null, DataContext);
+ }
+
+ //store a reference to the used tooltip
+ SetTrayToolTipResolved(tt);
+ }
+
+
+ ///
+ /// Sets tooltip settings for the class depending on defined
+ /// dependency properties and OS support.
+ ///
+ private void WriteToolTipSettings()
+ {
+ const IconDataMembers flags = IconDataMembers.Tip;
+ iconData.ToolTipText = ToolTipText;
+
+ if (messageSink.Version == NotifyIconVersion.Vista)
+ {
+ //we need to set a tooltip text to get tooltip events from the
+ //taskbar icon
+ 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)
+ iconData.ToolTipText = "ToolTip";
+ }
+ }
+
+ //update the tooltip text
+ Util.WriteIconData(ref iconData, NotifyCommand.Modify, flags);
+ }
+
+ #endregion
+
+ #region Custom Popup
+
+ ///
+ /// Creates a control that either
+ /// wraps the currently set
+ /// control or the string.
+ /// If itself is already
+ /// a instance, it will be used directly.
+ ///
+ /// We use a rather than
+ /// 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
+ /// property which prevents this issue.
+ private void CreatePopup()
+ {
+ //check if the item itself is a popup
+ Popup popup = TrayPopup as Popup;
+
+ if (popup == null && TrayPopup != null)
+ {
+ //create an invisible popup that hosts the UIElement
+ popup = new Popup();
+ popup.AllowsTransparency = true;
+
+ //don't animate by default - devs can use attached
+ //events or override
+ popup.PopupAnimation = PopupAnimation.None;
+
+ //the CreateRootPopup method outputs binding errors in the debug window because
+ //it tries to bind to "Popup-specific" properties in case they are provided by the child.
+ //We don't need that so just assign the control as the child.
+ popup.Child = TrayPopup;
+
+ //do *not* set the placement target, as it causes the popup to become hidden if the
+ //TaskbarIcon's parent is hidden, too. At runtime, the parent can be resolved through
+ //the ParentTaskbarIcon attached dependency property:
+ //popup.PlacementTarget = this;
+
+ popup.Placement = PlacementMode.AbsolutePoint;
+ popup.StaysOpen = false;
+ }
+
+ //the popup explicitly gets the DataContext of this instance.
+ //If there is no DataContext, the TaskbarIcon assigns itself
+ if (popup != null)
+ {
+ UpdateDataContext(popup, null, DataContext);
+ }
+
+ //store a reference to the used tooltip
+ SetTrayPopupResolved(popup);
+ }
+
+
+ ///
+ /// Displays the control if
+ /// it was set.
+ ///
+ private void ShowTrayPopup(Point cursorPosition)
+ {
+ if (IsDisposed) return;
+
+ //raise preview event no matter whether popup is currently set
+ //or not (enables client to set it on demand)
+ var args = RaisePreviewTrayPopupOpenEvent();
+ if (args.Handled) return;
+
+ if (TrayPopup != null)
+ {
+ //use absolute position, but place the popup centered above the icon
+ TrayPopupResolved.Placement = PlacementMode.AbsolutePoint;
+ TrayPopupResolved.HorizontalOffset = cursorPosition.X;
+ TrayPopupResolved.VerticalOffset = cursorPosition.Y;
+
+ //open popup
+ TrayPopupResolved.IsOpen = true;
+
+ IntPtr handle = IntPtr.Zero;
+ if (TrayPopupResolved.Child != null)
+ {
+ //try to get a handle on the popup itself (via its child)
+ HwndSource source = (HwndSource) PresentationSource.FromVisual(TrayPopupResolved.Child);
+ if (source != null) handle = source.Handle;
+ }
+
+ //if we don't have a handle for the popup, fall back to the message sink
+ if (handle == IntPtr.Zero) handle = messageSink.MessageWindowHandle;
+
+ //activate either popup or message sink to track deactivation.
+ //otherwise, the popup does not close if the user clicks somewhere else
+ WinApi.SetForegroundWindow(handle);
+
+ //raise attached event - item should never be null unless developers
+ //changed the CustomPopup directly...
+ if (TrayPopup != null) RaisePopupOpenedEvent(TrayPopup);
+
+ //bubble routed event
+ RaiseTrayPopupOpenEvent();
+ }
+ }
+
+ #endregion
+
+ #region Context Menu
+
+ ///
+ /// Displays the if
+ /// it was set.
+ ///
+ private void ShowContextMenu(Point cursorPosition)
+ {
+ if (IsDisposed) return;
+
+ //raise preview event no matter whether context menu is currently set
+ //or not (enables client to set it on demand)
+ var args = RaisePreviewTrayContextMenuOpenEvent();
+ if (args.Handled) return;
+
+ if (ContextMenu != null)
+ {
+ //use absolute positioning. We need to set the coordinates, or a delayed opening
+ //(e.g. when left-clicked) opens the context menu at the wrong place if the mouse
+ //is moved!
+ ContextMenu.Placement = PlacementMode.AbsolutePoint;
+ ContextMenu.HorizontalOffset = cursorPosition.X;
+ ContextMenu.VerticalOffset = cursorPosition.Y;
+ ContextMenu.IsOpen = true;
+
+ IntPtr handle = IntPtr.Zero;
+
+ //try to get a handle on the context itself
+ HwndSource source = (HwndSource) PresentationSource.FromVisual(ContextMenu);
+ if (source != null)
+ {
+ handle = source.Handle;
+ }
+
+ //if we don't have a handle for the popup, fall back to the message sink
+ if (handle == IntPtr.Zero) handle = messageSink.MessageWindowHandle;
+
+ //activate the context menu or the message window to track deactivation - otherwise, the context menu
+ //does not close if the user clicks somewhere else. With the message window
+ //fallback, the context menu can't receive keyboard events - should not happen though
+ WinApi.SetForegroundWindow(handle);
+
+ //bubble event
+ RaiseTrayContextMenuOpenEvent();
+ }
+ }
+
+ #endregion
+
+ #region Balloon Tips
+
+ ///
+ /// Bubbles events if a balloon ToolTip was displayed
+ /// or removed.
+ ///
+ /// Whether the ToolTip was just displayed
+ /// or removed.
+ private void OnBalloonToolTipChanged(bool visible)
+ {
+ if (visible)
+ {
+ RaiseTrayBalloonTipShownEvent();
+ }
+ else
+ {
+ RaiseTrayBalloonTipClosedEvent();
+ }
+ }
+
+ ///
+ /// Displays a balloon tip with the specified title,
+ /// text, and icon in the taskbar for the specified time period.
+ ///
+ /// The title to display on the balloon tip.
+ /// The text to display on the balloon tip.
+ /// A symbol that indicates the severity.
+ public void ShowBalloonTip(string title, string message, BalloonIcon symbol)
+ {
+ lock (this)
+ {
+ ShowBalloonTip(title, message, symbol.GetBalloonFlag(), IntPtr.Zero);
+ }
+ }
+
+
+ ///
+ /// Displays a balloon tip with the specified title,
+ /// text, and a custom icon in the taskbar for the specified time period.
+ ///
+ /// The title to display on the balloon tip.
+ /// The text to display on the balloon tip.
+ /// A custom icon.
+ /// If
+ /// is a null reference.
+ public void ShowBalloonTip(string title, string message, Icon customIcon)
+ {
+ if (customIcon == null) throw new ArgumentNullException("customIcon");
+
+ lock (this)
+ {
+ ShowBalloonTip(title, message, BalloonFlags.User, customIcon.Handle);
+ }
+ }
+
+
+ ///
+ /// Invokes in order to display
+ /// a given balloon ToolTip.
+ ///
+ /// The title to display on the balloon tip.
+ /// The text to display on the balloon tip.
+ /// Indicates what icon to use.
+ /// A handle to a custom icon, if any, or
+ /// .
+ private void ShowBalloonTip(string title, string message, BalloonFlags flags, IntPtr balloonIconHandle)
+ {
+ EnsureNotDisposed();
+
+ iconData.BalloonText = message ?? String.Empty;
+ iconData.BalloonTitle = title ?? String.Empty;
+
+ iconData.BalloonFlags = flags;
+ iconData.CustomBalloonIconHandle = balloonIconHandle;
+ Util.WriteIconData(ref iconData, NotifyCommand.Modify, IconDataMembers.Info | IconDataMembers.Icon);
+ }
+
+
+ ///
+ /// Hides a balloon ToolTip, if any is displayed.
+ ///
+ public void HideBalloonTip()
+ {
+ EnsureNotDisposed();
+
+ //reset balloon by just setting the info to an empty string
+ iconData.BalloonText = iconData.BalloonTitle = String.Empty;
+ Util.WriteIconData(ref iconData, NotifyCommand.Modify, IconDataMembers.Info);
+ }
+
+ #endregion
+
+ #region Single Click Timer event
+
+ ///
+ /// 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 .
+ ///
+ private void DoSingleClickAction(object state)
+ {
+ if (IsDisposed) return;
+
+ //run action
+ Action action = singleClickTimerAction;
+ if (action != null)
+ {
+ //cleanup action
+ singleClickTimerAction = null;
+
+ //switch to UI thread
+ this.GetDispatcher().Invoke(action);
+ }
+ }
+
+ #endregion
+
+ #region Set Version (API)
+
+ ///
+ /// Sets the version flag for the .
+ ///
+ private void SetVersion()
+ {
+ iconData.VersionOrTimeout = (uint) NotifyIconVersion.Vista;
+ bool status = WinApi.Shell_NotifyIcon(NotifyCommand.SetVersion, ref iconData);
+
+ if (!status)
+ {
+ iconData.VersionOrTimeout = (uint) NotifyIconVersion.Win2000;
+ status = Util.WriteIconData(ref iconData, NotifyCommand.SetVersion);
+ }
+
+ if (!status)
+ {
+ iconData.VersionOrTimeout = (uint) NotifyIconVersion.Win95;
+ status = Util.WriteIconData(ref iconData, NotifyCommand.SetVersion);
+ }
+
+ if (!status)
+ {
+ Debug.Fail("Could not set version");
+ }
+ }
+
+ #endregion
+
+ #region Create / Remove Taskbar Icon
+
+ ///
+ /// Recreates the taskbar icon if the whole taskbar was
+ /// recreated (e.g. because Explorer was shut down).
+ ///
+ private void OnTaskbarCreated()
+ {
+ IsTaskbarIconCreated = false;
+ CreateTaskbarIcon();
+ }
+
+
+ ///
+ /// Creates the taskbar icon. This message is invoked during initialization,
+ /// if the taskbar is restarted, and whenever the icon is displayed.
+ ///
+ private void CreateTaskbarIcon()
+ {
+ lock (this)
+ {
+ if (!IsTaskbarIconCreated)
+ {
+ const IconDataMembers members = IconDataMembers.Message
+ | IconDataMembers.Icon
+ | IconDataMembers.Tip;
+
+ //write initial configuration
+ var status = Util.WriteIconData(ref iconData, NotifyCommand.Add, members);
+ if (!status)
+ {
+ //couldn't create the icon - we can assume this is because explorer is not running (yet!)
+ //-> try a bit later again rather than throwing an exception. Typically, if the windows
+ // shell is being loaded later, this method is being reinvoked from OnTaskbarCreated
+ // (we could also retry after a delay, but that's currently YAGNI)
+ return;
+ }
+
+ //set to most recent version
+ SetVersion();
+ messageSink.Version = (NotifyIconVersion) iconData.VersionOrTimeout;
+
+ IsTaskbarIconCreated = true;
+ }
+ }
+ }
+
+ ///
+ /// Closes the taskbar icon if required.
+ ///
+ private void RemoveTaskbarIcon()
+ {
+ lock (this)
+ {
+ //make sure we didn't schedule a creation
+
+ if (IsTaskbarIconCreated)
+ {
+ Util.WriteIconData(ref iconData, NotifyCommand.Delete, IconDataMembers.Message);
+ IsTaskbarIconCreated = false;
+ }
+ }
+ }
+
+ #endregion
+
+ ///
+ /// Recalculates OS coordinates in order to support WPFs coordinate
+ /// system if OS scaling (DPIs) is not 100%.
+ ///
+ ///
+ ///
+ private Point GetDeviceCoordinates(Point point)
+ {
+ if (double.IsNaN(scalingFactor))
+ {
+ //calculate scaling factor in order to support non-standard DPIs
+ var presentationSource = PresentationSource.FromVisual(this);
+ if (presentationSource == null)
+ {
+ scalingFactor = 1;
+ }
+ else
+ {
+ var transform = presentationSource.CompositionTarget.TransformToDevice;
+ scalingFactor = 1/transform.M11;
+ }
+ }
+
+ //on standard DPI settings, just return the point
+ if (scalingFactor == 1.0) return point;
+
+ return new Point() {X = (int) (point.X*scalingFactor), Y = (int) (point.Y*scalingFactor)};
+ }
+
+ #region Dispose / Exit
+
+ ///
+ /// Set to true as soon as Dispose has been invoked.
+ ///
+ public bool IsDisposed { get; private set; }
+
+
+ ///
+ /// Checks if the object has been disposed and
+ /// raises a in case
+ /// the flag is true.
+ ///
+ private void EnsureNotDisposed()
+ {
+ if (IsDisposed) throw new ObjectDisposedException(Name ?? GetType().FullName);
+ }
+
+
+ ///
+ /// Disposes the class if the application exits.
+ ///
+ private void OnExit(object sender, EventArgs e)
+ {
+ Dispose();
+ }
+
+
+ ///
+ /// This destructor will run only if the
+ /// method does not get called. This gives this base class the
+ /// opportunity to finalize.
+ ///
+ /// Important: Do not provide destructors in types derived from
+ /// this class.
+ ///
+ ///
+ ~TaskbarIcon()
+ {
+ Dispose(false);
+ }
+
+
+ ///
+ /// Disposes the object.
+ ///
+ /// This method is not virtual by design. Derived classes
+ /// should override .
+ ///
+ public void Dispose()
+ {
+ Dispose(true);
+
+ // This object will be cleaned up by the Dispose method.
+ // Therefore, you should call GC.SupressFinalize to
+ // take this object off the finalization queue
+ // and prevent finalization code for this object
+ // from executing a second time.
+ GC.SuppressFinalize(this);
+ }
+
+
+ ///
+ /// 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.
+ ///
+ /// If disposing equals false, the method
+ /// has been called by the runtime from inside the finalizer and you
+ /// should not reference other objects. Only unmanaged resources can
+ /// be disposed.
+ /// Check the property to determine whether
+ /// the method has already been called.
+ private void Dispose(bool disposing)
+ {
+ //don't do anything if the component is already disposed
+ if (IsDisposed || !disposing) return;
+
+ lock (this)
+ {
+ IsDisposed = true;
+
+ //deregister application event listener
+ if (Application.Current != null)
+ {
+ Application.Current.Exit -= OnExit;
+ }
+
+ //stop timers
+ singleClickTimer.Dispose();
+ balloonCloseTimer.Dispose();
+
+ //dispose message sink
+ messageSink.Dispose();
+
+ //remove icon
+ RemoveTaskbarIcon();
+ }
+ }
+
+ #endregion
+ }
}
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Util.cs b/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Util.cs
index 3d5327a..b7db32a 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Util.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Util.cs
@@ -1,309 +1,309 @@
-// hardcodet.net NotifyIcon for WPF
-// Copyright (c) 2009 - 2013 Philipp Sumi
-// Contact and Information: http://www.hardcodet.net
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the Code Project Open License (CPOL);
-// either version 1.0 of the License, or (at your option) any later
-// version.
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-//
-// THIS COPYRIGHT NOTICE MAY NOT BE REMOVED FROM THIS FILE
-
-
-using System;
-using System.ComponentModel;
-using System.Drawing;
-using System.Windows;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Resources;
-using System.Windows.Threading;
-using Hardcodet.Wpf.TaskbarNotification.Interop;
-
-namespace Hardcodet.Wpf.TaskbarNotification
-{
- ///
- /// Util and extension methods.
- ///
- internal static class Util
- {
- public static readonly object SyncRoot = new object();
-
- #region IsDesignMode
-
- private static readonly bool isDesignMode;
-
- ///
- /// Checks whether the application is currently in design mode.
- ///
- public static bool IsDesignMode
- {
- get { return isDesignMode; }
- }
-
- #endregion
-
- #region construction
-
- static Util()
- {
- isDesignMode =
- (bool)
- DependencyPropertyDescriptor.FromProperty(DesignerProperties.IsInDesignModeProperty,
- typeof (FrameworkElement))
- .Metadata.DefaultValue;
- }
-
- #endregion
-
- #region CreateHelperWindow
-
- ///
- /// Creates an transparent window without dimension that
- /// can be used to temporarily obtain focus and/or
- /// be used as a window message sink.
- ///
- /// Empty window.
- public static Window CreateHelperWindow()
- {
- return new Window
- {
- Width = 0,
- Height = 0,
- ShowInTaskbar = false,
- WindowStyle = WindowStyle.None,
- AllowsTransparency = true,
- Opacity = 0
- };
- }
-
- #endregion
-
- #region WriteIconData
-
- ///
- /// Updates the taskbar icons with data provided by a given
- /// instance.
- ///
- /// Configuration settings for the NotifyIcon.
- /// Operation on the icon (e.g. delete the icon).
- /// True if the data was successfully written.
- /// See Shell_NotifyIcon documentation on MSDN for details.
- public static bool WriteIconData(ref NotifyIconData data, NotifyCommand command)
- {
- return WriteIconData(ref data, command, data.ValidMembers);
- }
-
-
- ///
- /// Updates the taskbar icons with data provided by a given
- /// instance.
- ///
- /// Configuration settings for the NotifyIcon.
- /// Operation on the icon (e.g. delete the icon).
- /// Defines which members of the
- /// structure are set.
- /// True if the data was successfully written.
- /// See Shell_NotifyIcon documentation on MSDN for details.
- public static bool WriteIconData(ref NotifyIconData data, NotifyCommand command, IconDataMembers flags)
- {
- //do nothing if in design mode
- if (IsDesignMode) return true;
-
- data.ValidMembers = flags;
- lock (SyncRoot)
- {
- return WinApi.Shell_NotifyIcon(command, ref data);
- }
- }
-
- #endregion
-
- #region GetBalloonFlag
-
- ///
- /// Gets a enum value that
- /// matches a given .
- ///
- public static BalloonFlags GetBalloonFlag(this BalloonIcon icon)
- {
- switch (icon)
- {
- case BalloonIcon.None:
- return BalloonFlags.None;
- case BalloonIcon.Info:
- return BalloonFlags.Info;
- case BalloonIcon.Warning:
- return BalloonFlags.Warning;
- case BalloonIcon.Error:
- return BalloonFlags.Error;
- default:
- throw new ArgumentOutOfRangeException("icon");
- }
- }
-
- #endregion
-
- #region ImageSource to Icon
-
- ///
- /// Reads a given image resource into a WinForms icon.
- ///
- /// Image source pointing to
- /// an icon file (*.ico).
- /// An icon object that can be used with the
- /// taskbar area.
- public static Icon ToIcon(this ImageSource imageSource)
- {
- if (imageSource == null) return null;
-
- Uri uri = new Uri(imageSource.ToString());
- StreamResourceInfo streamInfo = Application.GetResourceStream(uri);
-
- if (streamInfo == null)
- {
- string msg = "The supplied image source '{0}' could not be resolved.";
- msg = String.Format(msg, imageSource);
- throw new ArgumentException(msg);
- }
-
- return new Icon(streamInfo.Stream);
- }
-
- #endregion
-
- #region evaluate listings
-
- ///
- /// Checks a list of candidates for equality to a given
- /// reference value.
- ///
- ///
- /// The evaluated value.
- /// A liste of possible values that are
- /// regarded valid.
- /// True if one of the submitted
- /// matches the evaluated value. If the
- /// parameter itself is null, too, the method returns false as well,
- /// which allows to check with null values, too.
- /// If
- /// is a null reference.
- public static bool Is(this T value, params T[] candidates)
- {
- if (candidates == null) return false;
-
- foreach (var t in candidates)
- {
- if (value.Equals(t)) return true;
- }
-
- return false;
- }
-
- #endregion
-
- #region match MouseEvent to PopupActivation
-
- ///
- /// Checks if a given is a match for
- /// an effectively pressed mouse button.
- ///
- public static bool IsMatch(this MouseEvent me, PopupActivationMode activationMode)
- {
- switch (activationMode)
- {
- case PopupActivationMode.LeftClick:
- return me == MouseEvent.IconLeftMouseUp;
- case PopupActivationMode.RightClick:
- return me == MouseEvent.IconRightMouseUp;
- case PopupActivationMode.LeftOrRightClick:
- return me.Is(MouseEvent.IconLeftMouseUp, MouseEvent.IconRightMouseUp);
- case PopupActivationMode.LeftOrDoubleClick:
- return me.Is(MouseEvent.IconLeftMouseUp, MouseEvent.IconDoubleClick);
- case PopupActivationMode.DoubleClick:
- return me.Is(MouseEvent.IconDoubleClick);
- case PopupActivationMode.MiddleClick:
- return me == MouseEvent.IconMiddleMouseUp;
- case PopupActivationMode.All:
- //return true for everything except mouse movements
- return me != MouseEvent.MouseMove;
- default:
- throw new ArgumentOutOfRangeException("activationMode");
- }
- }
-
- #endregion
-
- #region execute command
-
- ///
- /// Executes a given command if its method
- /// indicates it can run.
- ///
- /// The command to be executed, or a null reference.
- /// An optional parameter that is associated with
- /// the command.
- /// The target element on which to raise the command.
- public static void ExecuteIfEnabled(this ICommand command, object commandParameter, IInputElement target)
- {
- if (command == null) return;
-
- RoutedCommand rc = command as RoutedCommand;
- if (rc != null)
- {
- //routed commands work on a target
- if (rc.CanExecute(commandParameter, target)) rc.Execute(commandParameter, target);
- }
- else if (command.CanExecute(commandParameter))
- {
- command.Execute(commandParameter);
- }
- }
-
- #endregion
-
- ///
- /// Returns a dispatcher for multi-threaded scenarios
- ///
- ///
- internal static Dispatcher GetDispatcher(this DispatcherObject source)
- {
- //use the application's dispatcher by default
- if (Application.Current != null) return Application.Current.Dispatcher;
-
- //fallback for WinForms environments
- if (source.Dispatcher != null) return source.Dispatcher;
-
- //ultimatively use the thread's dispatcher
- return Dispatcher.CurrentDispatcher;
- }
-
-
- ///
- /// Checks whether the
- /// is bound or not.
- ///
- /// The element to be checked.
- /// True if the data context property is being managed by a
- /// binding expression.
- /// If
- /// is a null reference.
- public static bool IsDataContextDataBound(this FrameworkElement element)
- {
- if (element == null) throw new ArgumentNullException("element");
- return element.GetBindingExpression(FrameworkElement.DataContextProperty) != null;
- }
- }
+// hardcodet.net NotifyIcon for WPF
+// Copyright (c) 2009 - 2013 Philipp Sumi
+// Contact and Information: http://www.hardcodet.net
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the Code Project Open License (CPOL);
+// either version 1.0 of the License, or (at your option) any later
+// version.
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+//
+// THIS COPYRIGHT NOTICE MAY NOT BE REMOVED FROM THIS FILE
+
+
+using System;
+using System.ComponentModel;
+using System.Drawing;
+using System.Windows;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Resources;
+using System.Windows.Threading;
+using Hardcodet.Wpf.TaskbarNotification.Interop;
+
+namespace Hardcodet.Wpf.TaskbarNotification
+{
+ ///
+ /// Util and extension methods.
+ ///
+ internal static class Util
+ {
+ public static readonly object SyncRoot = new object();
+
+ #region IsDesignMode
+
+ private static readonly bool isDesignMode;
+
+ ///
+ /// Checks whether the application is currently in design mode.
+ ///
+ public static bool IsDesignMode
+ {
+ get { return isDesignMode; }
+ }
+
+ #endregion
+
+ #region construction
+
+ static Util()
+ {
+ isDesignMode =
+ (bool)
+ DependencyPropertyDescriptor.FromProperty(DesignerProperties.IsInDesignModeProperty,
+ typeof (FrameworkElement))
+ .Metadata.DefaultValue;
+ }
+
+ #endregion
+
+ #region CreateHelperWindow
+
+ ///
+ /// Creates an transparent window without dimension that
+ /// can be used to temporarily obtain focus and/or
+ /// be used as a window message sink.
+ ///
+ /// Empty window.
+ public static Window CreateHelperWindow()
+ {
+ return new Window
+ {
+ Width = 0,
+ Height = 0,
+ ShowInTaskbar = false,
+ WindowStyle = WindowStyle.None,
+ AllowsTransparency = true,
+ Opacity = 0
+ };
+ }
+
+ #endregion
+
+ #region WriteIconData
+
+ ///
+ /// Updates the taskbar icons with data provided by a given
+ /// instance.
+ ///
+ /// Configuration settings for the NotifyIcon.
+ /// Operation on the icon (e.g. delete the icon).
+ /// True if the data was successfully written.
+ /// See Shell_NotifyIcon documentation on MSDN for details.
+ public static bool WriteIconData(ref NotifyIconData data, NotifyCommand command)
+ {
+ return WriteIconData(ref data, command, data.ValidMembers);
+ }
+
+
+ ///
+ /// Updates the taskbar icons with data provided by a given
+ /// instance.
+ ///
+ /// Configuration settings for the NotifyIcon.
+ /// Operation on the icon (e.g. delete the icon).
+ /// Defines which members of the
+ /// structure are set.
+ /// True if the data was successfully written.
+ /// See Shell_NotifyIcon documentation on MSDN for details.
+ public static bool WriteIconData(ref NotifyIconData data, NotifyCommand command, IconDataMembers flags)
+ {
+ //do nothing if in design mode
+ if (IsDesignMode) return true;
+
+ data.ValidMembers = flags;
+ lock (SyncRoot)
+ {
+ return WinApi.Shell_NotifyIcon(command, ref data);
+ }
+ }
+
+ #endregion
+
+ #region GetBalloonFlag
+
+ ///
+ /// Gets a enum value that
+ /// matches a given .
+ ///
+ public static BalloonFlags GetBalloonFlag(this BalloonIcon icon)
+ {
+ switch (icon)
+ {
+ case BalloonIcon.None:
+ return BalloonFlags.None;
+ case BalloonIcon.Info:
+ return BalloonFlags.Info;
+ case BalloonIcon.Warning:
+ return BalloonFlags.Warning;
+ case BalloonIcon.Error:
+ return BalloonFlags.Error;
+ default:
+ throw new ArgumentOutOfRangeException("icon");
+ }
+ }
+
+ #endregion
+
+ #region ImageSource to Icon
+
+ ///
+ /// Reads a given image resource into a WinForms icon.
+ ///
+ /// Image source pointing to
+ /// an icon file (*.ico).
+ /// An icon object that can be used with the
+ /// taskbar area.
+ public static Icon ToIcon(this ImageSource imageSource)
+ {
+ if (imageSource == null) return null;
+
+ Uri uri = new Uri(imageSource.ToString());
+ StreamResourceInfo streamInfo = Application.GetResourceStream(uri);
+
+ if (streamInfo == null)
+ {
+ string msg = "The supplied image source '{0}' could not be resolved.";
+ msg = String.Format(msg, imageSource);
+ throw new ArgumentException(msg);
+ }
+
+ return new Icon(streamInfo.Stream);
+ }
+
+ #endregion
+
+ #region evaluate listings
+
+ ///
+ /// Checks a list of candidates for equality to a given
+ /// reference value.
+ ///
+ ///
+ /// The evaluated value.
+ /// A liste of possible values that are
+ /// regarded valid.
+ /// True if one of the submitted
+ /// matches the evaluated value. If the
+ /// parameter itself is null, too, the method returns false as well,
+ /// which allows to check with null values, too.
+ /// If
+ /// is a null reference.
+ public static bool Is(this T value, params T[] candidates)
+ {
+ if (candidates == null) return false;
+
+ foreach (var t in candidates)
+ {
+ if (value.Equals(t)) return true;
+ }
+
+ return false;
+ }
+
+ #endregion
+
+ #region match MouseEvent to PopupActivation
+
+ ///
+ /// Checks if a given is a match for
+ /// an effectively pressed mouse button.
+ ///
+ public static bool IsMatch(this MouseEvent me, PopupActivationMode activationMode)
+ {
+ switch (activationMode)
+ {
+ case PopupActivationMode.LeftClick:
+ return me == MouseEvent.IconLeftMouseUp;
+ case PopupActivationMode.RightClick:
+ return me == MouseEvent.IconRightMouseUp;
+ case PopupActivationMode.LeftOrRightClick:
+ return me.Is(MouseEvent.IconLeftMouseUp, MouseEvent.IconRightMouseUp);
+ case PopupActivationMode.LeftOrDoubleClick:
+ return me.Is(MouseEvent.IconLeftMouseUp, MouseEvent.IconDoubleClick);
+ case PopupActivationMode.DoubleClick:
+ return me.Is(MouseEvent.IconDoubleClick);
+ case PopupActivationMode.MiddleClick:
+ return me == MouseEvent.IconMiddleMouseUp;
+ case PopupActivationMode.All:
+ //return true for everything except mouse movements
+ return me != MouseEvent.MouseMove;
+ default:
+ throw new ArgumentOutOfRangeException("activationMode");
+ }
+ }
+
+ #endregion
+
+ #region execute command
+
+ ///
+ /// Executes a given command if its method
+ /// indicates it can run.
+ ///
+ /// The command to be executed, or a null reference.
+ /// An optional parameter that is associated with
+ /// the command.
+ /// The target element on which to raise the command.
+ public static void ExecuteIfEnabled(this ICommand command, object commandParameter, IInputElement target)
+ {
+ if (command == null) return;
+
+ RoutedCommand rc = command as RoutedCommand;
+ if (rc != null)
+ {
+ //routed commands work on a target
+ if (rc.CanExecute(commandParameter, target)) rc.Execute(commandParameter, target);
+ }
+ else if (command.CanExecute(commandParameter))
+ {
+ command.Execute(commandParameter);
+ }
+ }
+
+ #endregion
+
+ ///
+ /// Returns a dispatcher for multi-threaded scenarios
+ ///
+ ///
+ internal static Dispatcher GetDispatcher(this DispatcherObject source)
+ {
+ //use the application's dispatcher by default
+ if (Application.Current != null) return Application.Current.Dispatcher;
+
+ //fallback for WinForms environments
+ if (source.Dispatcher != null) return source.Dispatcher;
+
+ //ultimatively use the thread's dispatcher
+ return Dispatcher.CurrentDispatcher;
+ }
+
+
+ ///
+ /// Checks whether the
+ /// is bound or not.
+ ///
+ /// The element to be checked.
+ /// True if the data context property is being managed by a
+ /// binding expression.
+ /// If
+ /// is a null reference.
+ public static bool IsDataContextDataBound(this FrameworkElement element)
+ {
+ if (element == null) throw new ArgumentNullException("element");
+ return element.GetBindingExpression(FrameworkElement.DataContextProperty) != null;
+ }
+ }
}
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/App.xaml b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/App.xaml
index 11ae36c..318ca54 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/App.xaml
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/App.xaml
@@ -1,14 +1,14 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/App.xaml.cs b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/App.xaml.cs
index 6410157..51b78ac 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/App.xaml.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/App.xaml.cs
@@ -1,17 +1,17 @@
-using System;
-using System.Collections.Generic;
-using System.Configuration;
-using System.Data;
-using System.Linq;
-using System.Windows;
-using Hardcodet.Wpf.TaskbarNotification;
-
-namespace Samples
-{
- ///
- /// Interaction logic for App.xaml
- ///
- public partial class App : Application
- {
- }
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Data;
+using System.Linq;
+using System.Windows;
+using Hardcodet.Wpf.TaskbarNotification;
+
+namespace Samples
+{
+ ///
+ /// Interaction logic for App.xaml
+ ///
+ public partial class App : Application
+ {
+ }
}
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Commands/CloseWindowCommand.cs b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Commands/CloseWindowCommand.cs
index 2b47832..00930e8 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Commands/CloseWindowCommand.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Commands/CloseWindowCommand.cs
@@ -1,24 +1,24 @@
-using System.Windows;
-using System.Windows.Input;
-
-namespace Samples.Commands
-{
- ///
- /// Closes the current window.
- ///
- public class CloseWindowCommand : CommandBase
- {
- public override void Execute(object parameter)
- {
- GetTaskbarWindow(parameter).Close();
- CommandManager.InvalidateRequerySuggested();
- }
-
-
- public override bool CanExecute(object parameter)
- {
- Window win = GetTaskbarWindow(parameter);
- return win != null;
- }
- }
+using System.Windows;
+using System.Windows.Input;
+
+namespace Samples.Commands
+{
+ ///
+ /// Closes the current window.
+ ///
+ public class CloseWindowCommand : CommandBase
+ {
+ public override void Execute(object parameter)
+ {
+ GetTaskbarWindow(parameter).Close();
+ CommandManager.InvalidateRequerySuggested();
+ }
+
+
+ public override bool CanExecute(object parameter)
+ {
+ Window win = GetTaskbarWindow(parameter);
+ return win != null;
+ }
+ }
}
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Commands/CommandBase.cs b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Commands/CommandBase.cs
index ccfe761..ed0ae3b 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Commands/CommandBase.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Commands/CommandBase.cs
@@ -1,157 +1,157 @@
-using System;
-using System.ComponentModel;
-using System.Windows;
-using System.Windows.Input;
-using System.Windows.Markup;
-using System.Windows.Media;
-using Hardcodet.Wpf.TaskbarNotification;
-
-namespace Samples.Commands
-{
- ///
- /// Basic implementation of the
- /// interface, which is also accessible as a markup
- /// extension.
- ///
- public abstract class CommandBase : MarkupExtension, ICommand
- where T : class, ICommand, new()
- {
- ///
- /// A singleton instance.
- ///
- private static T command;
-
- ///
- /// Gets a shared command instance.
- ///
- public override object ProvideValue(IServiceProvider serviceProvider)
- {
- if (command == null) command = new T();
- return command;
- }
-
- ///
- /// Fires when changes occur that affect whether
- /// or not the command should execute.
- ///
- public event EventHandler CanExecuteChanged
- {
- add { CommandManager.RequerySuggested += value; }
- remove { CommandManager.RequerySuggested -= value; }
- }
-
- ///
- /// Defines the method to be called when the command is invoked.
- ///
- /// Data used by the command.
- /// If the command does not require data to be passed,
- /// this object can be set to null.
- ///
- public abstract void Execute(object parameter);
-
- ///
- /// Defines the method that determines whether the command
- /// can execute in its current state.
- ///
- ///
- /// This default implementation always returns true.
- ///
- /// Data used by the command.
- /// If the command does not require data to be passed,
- /// this object can be set to null.
- ///
- public virtual bool CanExecute(object parameter)
- {
- return IsDesignMode ? false : true;
- }
-
-
- public static bool IsDesignMode
- {
- get
- {
- return (bool)
- DependencyPropertyDescriptor.FromProperty(DesignerProperties.IsInDesignModeProperty,
- typeof (FrameworkElement))
- .Metadata.DefaultValue;
- }
- }
-
-
- ///
- /// Resolves the window that owns the TaskbarIcon class.
- ///
- ///
- ///
- protected Window GetTaskbarWindow(object commandParameter)
- {
- if (IsDesignMode) return null;
-
- //get the showcase window off the taskbaricon
- var tb = commandParameter as TaskbarIcon;
- return tb == null ? null : TryFindParent(tb);
- }
-
- #region TryFindParent helper
-
- ///
- /// Finds a parent of a given item on the visual tree.
- ///
- /// The type of the queried item.
- /// A direct or indirect child of the
- /// queried item.
- /// The first parent item that matches the submitted
- /// type parameter. If not matching item can be found, a null
- /// reference is being returned.
- public static T TryFindParent(DependencyObject child)
- where T : DependencyObject
- {
- //get parent item
- DependencyObject parentObject = GetParentObject(child);
-
- //we've reached the end of the tree
- if (parentObject == null) return null;
-
- //check if the parent matches the type we're looking for
- T parent = parentObject as T;
- if (parent != null)
- {
- return parent;
- }
- else
- {
- //use recursion to proceed with next level
- return TryFindParent(parentObject);
- }
- }
-
- ///
- /// This method is an alternative to WPF's
- /// method, which also
- /// supports content elements. Keep in mind that for content element,
- /// this method falls back to the logical tree of the element!
- ///
- /// The item to be processed.
- /// The submitted item's parent, if available. Otherwise
- /// null.
- public static DependencyObject GetParentObject(DependencyObject child)
- {
- if (child == null) return null;
- ContentElement contentElement = child as ContentElement;
-
- if (contentElement != null)
- {
- DependencyObject parent = ContentOperations.GetParent(contentElement);
- if (parent != null) return parent;
-
- FrameworkContentElement fce = contentElement as FrameworkContentElement;
- return fce != null ? fce.Parent : null;
- }
-
- //if it's not a ContentElement, rely on VisualTreeHelper
- return VisualTreeHelper.GetParent(child);
- }
-
- #endregion
- }
+using System;
+using System.ComponentModel;
+using System.Windows;
+using System.Windows.Input;
+using System.Windows.Markup;
+using System.Windows.Media;
+using Hardcodet.Wpf.TaskbarNotification;
+
+namespace Samples.Commands
+{
+ ///
+ /// Basic implementation of the
+ /// interface, which is also accessible as a markup
+ /// extension.
+ ///
+ public abstract class CommandBase : MarkupExtension, ICommand
+ where T : class, ICommand, new()
+ {
+ ///
+ /// A singleton instance.
+ ///
+ private static T command;
+
+ ///
+ /// Gets a shared command instance.
+ ///
+ public override object ProvideValue(IServiceProvider serviceProvider)
+ {
+ if (command == null) command = new T();
+ return command;
+ }
+
+ ///
+ /// Fires when changes occur that affect whether
+ /// or not the command should execute.
+ ///
+ public event EventHandler CanExecuteChanged
+ {
+ add { CommandManager.RequerySuggested += value; }
+ remove { CommandManager.RequerySuggested -= value; }
+ }
+
+ ///
+ /// Defines the method to be called when the command is invoked.
+ ///
+ /// Data used by the command.
+ /// If the command does not require data to be passed,
+ /// this object can be set to null.
+ ///
+ public abstract void Execute(object parameter);
+
+ ///
+ /// Defines the method that determines whether the command
+ /// can execute in its current state.
+ ///
+ ///
+ /// This default implementation always returns true.
+ ///
+ /// Data used by the command.
+ /// If the command does not require data to be passed,
+ /// this object can be set to null.
+ ///
+ public virtual bool CanExecute(object parameter)
+ {
+ return IsDesignMode ? false : true;
+ }
+
+
+ public static bool IsDesignMode
+ {
+ get
+ {
+ return (bool)
+ DependencyPropertyDescriptor.FromProperty(DesignerProperties.IsInDesignModeProperty,
+ typeof (FrameworkElement))
+ .Metadata.DefaultValue;
+ }
+ }
+
+
+ ///
+ /// Resolves the window that owns the TaskbarIcon class.
+ ///
+ ///
+ ///
+ protected Window GetTaskbarWindow(object commandParameter)
+ {
+ if (IsDesignMode) return null;
+
+ //get the showcase window off the taskbaricon
+ var tb = commandParameter as TaskbarIcon;
+ return tb == null ? null : TryFindParent(tb);
+ }
+
+ #region TryFindParent helper
+
+ ///
+ /// Finds a parent of a given item on the visual tree.
+ ///
+ /// The type of the queried item.
+ /// A direct or indirect child of the
+ /// queried item.
+ /// The first parent item that matches the submitted
+ /// type parameter. If not matching item can be found, a null
+ /// reference is being returned.
+ public static T TryFindParent(DependencyObject child)
+ where T : DependencyObject
+ {
+ //get parent item
+ DependencyObject parentObject = GetParentObject(child);
+
+ //we've reached the end of the tree
+ if (parentObject == null) return null;
+
+ //check if the parent matches the type we're looking for
+ T parent = parentObject as T;
+ if (parent != null)
+ {
+ return parent;
+ }
+ else
+ {
+ //use recursion to proceed with next level
+ return TryFindParent(parentObject);
+ }
+ }
+
+ ///
+ /// This method is an alternative to WPF's
+ /// method, which also
+ /// supports content elements. Keep in mind that for content element,
+ /// this method falls back to the logical tree of the element!
+ ///
+ /// The item to be processed.
+ /// The submitted item's parent, if available. Otherwise
+ /// null.
+ public static DependencyObject GetParentObject(DependencyObject child)
+ {
+ if (child == null) return null;
+ ContentElement contentElement = child as ContentElement;
+
+ if (contentElement != null)
+ {
+ DependencyObject parent = ContentOperations.GetParent(contentElement);
+ if (parent != null) return parent;
+
+ FrameworkContentElement fce = contentElement as FrameworkContentElement;
+ return fce != null ? fce.Parent : null;
+ }
+
+ //if it's not a ContentElement, rely on VisualTreeHelper
+ return VisualTreeHelper.GetParent(child);
+ }
+
+ #endregion
+ }
}
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Commands/HideSampleWindowCommand.cs b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Commands/HideSampleWindowCommand.cs
index ca18829..0e5be4e 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Commands/HideSampleWindowCommand.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Commands/HideSampleWindowCommand.cs
@@ -1,24 +1,24 @@
-using System.Windows;
-using System.Windows.Input;
-
-namespace Samples.Commands
-{
- ///
- /// Hides the main window.
- ///
- public class HideSampleWindowCommand : CommandBase
- {
- public override void Execute(object parameter)
- {
- GetTaskbarWindow(parameter).Hide();
- CommandManager.InvalidateRequerySuggested();
- }
-
-
- public override bool CanExecute(object parameter)
- {
- Window win = GetTaskbarWindow(parameter);
- return win != null && win.IsVisible;
- }
- }
+using System.Windows;
+using System.Windows.Input;
+
+namespace Samples.Commands
+{
+ ///
+ /// Hides the main window.
+ ///
+ public class HideSampleWindowCommand : CommandBase
+ {
+ public override void Execute(object parameter)
+ {
+ GetTaskbarWindow(parameter).Hide();
+ CommandManager.InvalidateRequerySuggested();
+ }
+
+
+ public override bool CanExecute(object parameter)
+ {
+ Window win = GetTaskbarWindow(parameter);
+ return win != null && win.IsVisible;
+ }
+ }
}
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Commands/ShowSampleWindowCommand.cs b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Commands/ShowSampleWindowCommand.cs
index b35d8a3..f954968 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Commands/ShowSampleWindowCommand.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Commands/ShowSampleWindowCommand.cs
@@ -1,24 +1,24 @@
-using System.Windows;
-using System.Windows.Input;
-
-namespace Samples.Commands
-{
- ///
- /// Shows the main window.
- ///
- public class ShowSampleWindowCommand : CommandBase
- {
- public override void Execute(object parameter)
- {
- GetTaskbarWindow(parameter).Show();
- CommandManager.InvalidateRequerySuggested();
- }
-
-
- public override bool CanExecute(object parameter)
- {
- Window win = GetTaskbarWindow(parameter);
- return win != null && !win.IsVisible;
- }
- }
+using System.Windows;
+using System.Windows.Input;
+
+namespace Samples.Commands
+{
+ ///
+ /// Shows the main window.
+ ///
+ public class ShowSampleWindowCommand : CommandBase
+ {
+ public override void Execute(object parameter)
+ {
+ GetTaskbarWindow(parameter).Show();
+ CommandManager.InvalidateRequerySuggested();
+ }
+
+
+ public override bool CanExecute(object parameter)
+ {
+ Window win = GetTaskbarWindow(parameter);
+ return win != null && !win.IsVisible;
+ }
+ }
}
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Main.xaml b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Main.xaml
index 1421c8f..95473cc 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Main.xaml
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Main.xaml
@@ -1,242 +1,242 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Main.xaml.cs b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Main.xaml.cs
index 045bda1..c00ead9 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Main.xaml.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Main.xaml.cs
@@ -1,106 +1,106 @@
-using System.Diagnostics;
-using System.Windows;
-using Samples.Tutorials;
-using Samples.Tutorials.Balloons;
-using Samples.Tutorials.Commands;
-using Samples.Tutorials.ContextMenus;
-using Samples.Tutorials.DataBinding;
-using Samples.Tutorials.Events;
-using Samples.Tutorials.MvvmSample;
-using Samples.Tutorials.Popups;
-using Samples.Tutorials.ToolTips;
-
-namespace Samples
-{
- ///
- /// Interaction logic for Main.xaml
- ///
- public partial class Main : Window
- {
- public Main()
- {
- InitializeComponent();
- }
-
-
- ///
- /// Sets and
- /// properties of a dialog that
- /// is about to be displayed.
- ///
- /// The processed window.
- private void ShowDialog(Window window)
- {
- window.Owner = this;
- window.WindowStartupLocation = WindowStartupLocation.CenterOwner;
- window.ShowDialog();
- }
-
- private void btnDeclaration_Click(object sender, RoutedEventArgs e)
- {
- ShowDialog(new SimpleWindowWithNotifyIcon());
- }
-
-
- private void btnInlineToolTip_Click(object sender, RoutedEventArgs e)
- {
- ShowDialog(new InlineToolTipWindow());
- }
-
- private void btnToolTipControl_Click(object sender, RoutedEventArgs e)
- {
- ShowDialog(new UserControlToolTipWindow());
- }
-
- private void btnPopups_Click(object sender, RoutedEventArgs e)
- {
- ShowDialog(new InlinePopupWindow());
- }
-
- private void btnContextMenus_Click(object sender, RoutedEventArgs e)
- {
- ShowDialog(new InlineContextMenuWindow());
- }
-
- private void btnBalloons_Click(object sender, RoutedEventArgs e)
- {
- ShowDialog(new BalloonSampleWindow());
- }
-
- private void btnCommands_Click(object sender, RoutedEventArgs e)
- {
- ShowDialog(new CommandWindow());
- }
-
- private void btnEvents_Click(object sender, RoutedEventArgs e)
- {
- ShowDialog(new EventVisualizerWindow());
- }
-
- private void btnDataBinding_Click(object sender, RoutedEventArgs e)
- {
- ShowDialog(new DataBoundToolTipWindow());
- }
-
- private void btnMvvm_Click(object sender, System.Windows.RoutedEventArgs e)
- {
- ShowDialog(new MvvmSampleWindow());
- }
-
- private void btnMainSample_Click(object sender, RoutedEventArgs e)
- {
- var sampleWindow = new ShowcaseWindow();
-
- sampleWindow.Owner = this;
- sampleWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen;
- sampleWindow.ShowDialog();
- }
-
-
- private void OnNavigationRequest(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
- {
- Process.Start(e.Uri.ToString());
- e.Handled = true;
- }
- }
+using System.Diagnostics;
+using System.Windows;
+using Samples.Tutorials;
+using Samples.Tutorials.Balloons;
+using Samples.Tutorials.Commands;
+using Samples.Tutorials.ContextMenus;
+using Samples.Tutorials.DataBinding;
+using Samples.Tutorials.Events;
+using Samples.Tutorials.MvvmSample;
+using Samples.Tutorials.Popups;
+using Samples.Tutorials.ToolTips;
+
+namespace Samples
+{
+ ///
+ /// Interaction logic for Main.xaml
+ ///
+ public partial class Main : Window
+ {
+ public Main()
+ {
+ InitializeComponent();
+ }
+
+
+ ///
+ /// Sets and
+ /// properties of a dialog that
+ /// is about to be displayed.
+ ///
+ /// The processed window.
+ private void ShowDialog(Window window)
+ {
+ window.Owner = this;
+ window.WindowStartupLocation = WindowStartupLocation.CenterOwner;
+ window.ShowDialog();
+ }
+
+ private void btnDeclaration_Click(object sender, RoutedEventArgs e)
+ {
+ ShowDialog(new SimpleWindowWithNotifyIcon());
+ }
+
+
+ private void btnInlineToolTip_Click(object sender, RoutedEventArgs e)
+ {
+ ShowDialog(new InlineToolTipWindow());
+ }
+
+ private void btnToolTipControl_Click(object sender, RoutedEventArgs e)
+ {
+ ShowDialog(new UserControlToolTipWindow());
+ }
+
+ private void btnPopups_Click(object sender, RoutedEventArgs e)
+ {
+ ShowDialog(new InlinePopupWindow());
+ }
+
+ private void btnContextMenus_Click(object sender, RoutedEventArgs e)
+ {
+ ShowDialog(new InlineContextMenuWindow());
+ }
+
+ private void btnBalloons_Click(object sender, RoutedEventArgs e)
+ {
+ ShowDialog(new BalloonSampleWindow());
+ }
+
+ private void btnCommands_Click(object sender, RoutedEventArgs e)
+ {
+ ShowDialog(new CommandWindow());
+ }
+
+ private void btnEvents_Click(object sender, RoutedEventArgs e)
+ {
+ ShowDialog(new EventVisualizerWindow());
+ }
+
+ private void btnDataBinding_Click(object sender, RoutedEventArgs e)
+ {
+ ShowDialog(new DataBoundToolTipWindow());
+ }
+
+ private void btnMvvm_Click(object sender, System.Windows.RoutedEventArgs e)
+ {
+ ShowDialog(new MvvmSampleWindow());
+ }
+
+ private void btnMainSample_Click(object sender, RoutedEventArgs e)
+ {
+ var sampleWindow = new ShowcaseWindow();
+
+ sampleWindow.Owner = this;
+ sampleWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen;
+ sampleWindow.ShowDialog();
+ }
+
+
+ private void OnNavigationRequest(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
+ {
+ Process.Start(e.Uri.ToString());
+ e.Handled = true;
+ }
+ }
}
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Properties/AssemblyInfo.cs b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Properties/AssemblyInfo.cs
index 942e75e..061b7a4 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Properties/AssemblyInfo.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Properties/AssemblyInfo.cs
@@ -1,58 +1,58 @@
-using System.Reflection;
-using System.Resources;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Windows;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-
-[assembly: AssemblyTitle("Sample Project")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Microsoft")]
-[assembly: AssemblyProduct("Sample Project")]
-[assembly: AssemblyCopyright("Copyright © Microsoft 2009")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-
-[assembly: ComVisible(false)]
-
-//In order to begin building localizable applications, set
-//CultureYouAreCodingWith in your .csproj file
-//inside a . For example, if you are using US english
-//in your source files, set the to en-US. Then uncomment
-//the NeutralResourceLanguage attribute below. Update the "en-US" in
-//the line below to match the UICulture setting in the project file.
-
-//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
-
-
-[assembly: ThemeInfo(
- ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
- //(used if a resource is not found in the page,
- // or application resource dictionaries)
- ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
- //(used if a resource is not found in the page,
- // app, or any theme specific resource dictionaries)
- )]
-
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-
-[assembly: AssemblyVersion("1.0.0.0")]
+using System.Reflection;
+using System.Resources;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Windows;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+
+[assembly: AssemblyTitle("Sample Project")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("Sample Project")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2009")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+
+[assembly: ComVisible(false)]
+
+//In order to begin building localizable applications, set
+//CultureYouAreCodingWith in your .csproj file
+//inside a . For example, if you are using US english
+//in your source files, set the to en-US. Then uncomment
+//the NeutralResourceLanguage attribute below. Update the "en-US" in
+//the line below to match the UICulture setting in the project file.
+
+//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
+
+
+[assembly: ThemeInfo(
+ ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
+ //(used if a resource is not found in the page,
+ // or application resource dictionaries)
+ ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
+ //(used if a resource is not found in the page,
+ // app, or any theme specific resource dictionaries)
+ )]
+
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+
+[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Properties/Resources.Designer.cs b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Properties/Resources.Designer.cs
index 7a45feb..a678323 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Properties/Resources.Designer.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Properties/Resources.Designer.cs
@@ -1,93 +1,93 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.18408
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace Samples.Properties {
- using System;
-
-
- ///
- /// A strongly-typed resource class, for looking up localized strings, etc.
- ///
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Resources {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Resources() {
- }
-
- ///
- /// Returns the cached ResourceManager instance used by this class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
- get {
- if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Samples.Properties.Resources", typeof(Resources).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- ///
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
- get {
- return resourceCulture;
- }
- set {
- resourceCulture = value;
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
- ///
- internal static System.Drawing.Icon Bulb {
- get {
- object obj = ResourceManager.GetObject("Bulb", resourceCulture);
- return ((System.Drawing.Icon)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
- ///
- internal static System.Drawing.Icon Computers {
- get {
- object obj = ResourceManager.GetObject("Computers", resourceCulture);
- return ((System.Drawing.Icon)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
- ///
- internal static System.Drawing.Icon NetDrives {
- get {
- object obj = ResourceManager.GetObject("NetDrives", resourceCulture);
- return ((System.Drawing.Icon)(obj));
- }
- }
- }
-}
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.18408
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace Samples.Properties {
+ using System;
+
+
+ ///
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ ///
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ ///
+ /// Returns the cached ResourceManager instance used by this class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Samples.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+
+ ///
+ /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
+ ///
+ internal static System.Drawing.Icon Bulb {
+ get {
+ object obj = ResourceManager.GetObject("Bulb", resourceCulture);
+ return ((System.Drawing.Icon)(obj));
+ }
+ }
+
+ ///
+ /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
+ ///
+ internal static System.Drawing.Icon Computers {
+ get {
+ object obj = ResourceManager.GetObject("Computers", resourceCulture);
+ return ((System.Drawing.Icon)(obj));
+ }
+ }
+
+ ///
+ /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
+ ///
+ internal static System.Drawing.Icon NetDrives {
+ get {
+ object obj = ResourceManager.GetObject("NetDrives", resourceCulture);
+ return ((System.Drawing.Icon)(obj));
+ }
+ }
+ }
+}
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Properties/Resources.resx b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Properties/Resources.resx
index 98e1ee3..614a82e 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Properties/Resources.resx
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Properties/Resources.resx
@@ -1,130 +1,130 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
-
- ..\icons\bulb.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\icons\computers.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\icons\netdrives.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+
+ ..\icons\bulb.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\icons\computers.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\icons\netdrives.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Properties/Settings.Designer.cs b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Properties/Settings.Designer.cs
index 120da14..5df9eba 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Properties/Settings.Designer.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Properties/Settings.Designer.cs
@@ -1,26 +1,26 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.18408
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace Samples.Properties {
-
-
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
- internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
-
- private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
-
- public static Settings Default {
- get {
- return defaultInstance;
- }
- }
- }
-}
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.18408
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace Samples.Properties {
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default {
+ get {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Properties/Settings.settings b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Properties/Settings.settings
index 267ecc6..c14891b 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Properties/Settings.settings
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Properties/Settings.settings
@@ -1,8 +1,8 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Sample Project.csproj b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Sample Project.csproj
index 5412276..3f003ff 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Sample Project.csproj
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Sample Project.csproj
@@ -1,355 +1,355 @@
-
-
-
- Debug
- AnyCPU
- 9.0.30729
- 2.0
- {71C74F29-F1C2-49C5-969F-C25AC4CDFCCC}
- WinExe
- Properties
- Samples
- Sample Project
- v4.0
- 512
- {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- 4
-
-
- 3.5
-
- publish\
- true
- Disk
- false
- Foreground
- 7
- Days
- false
- false
- true
- 0
- 1.0.0.%2a
- false
- false
- true
- Client
- 12.0.41002.1
-
-
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
- AllRules.ruleset
- AnyCPU
-
-
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
- AllRules.ruleset
-
-
-
- ClockPopup.xaml
-
-
-
- MvvmSampleWindow.xaml
-
-
- MSBuild:Compile
- Designer
-
-
- Designer
- MSBuild:Compile
-
-
-
-
- 3.5
-
-
-
-
- 3.5
-
-
- 3.5
-
-
-
-
- 3.0
-
-
- 3.0
-
-
- 3.0
-
-
- 3.0
-
-
-
-
-
-
- MSBuild:Compile
- Designer
- MSBuild:Compile
- Designer
-
-
- MSBuild:Compile
- Designer
- MSBuild:Compile
- Designer
-
-
-
- FancyToolTip.xaml
-
-
-
-
-
-
- MSBuild:Compile
- Designer
- MSBuild:Compile
- Designer
-
-
- Designer
- MSBuild:Compile
- MSBuild:Compile
- Designer
-
-
- Designer
- MSBuild:Compile
- MSBuild:Compile
- Designer
-
-
- Designer
- MSBuild:Compile
- MSBuild:Compile
- Designer
-
-
- Designer
- MSBuild:Compile
- MSBuild:Compile
- Designer
-
-
- Designer
- MSBuild:Compile
- MSBuild:Compile
- Designer
-
-
- Designer
- MSBuild:Compile
- MSBuild:Compile
- Designer
-
-
- Designer
- MSBuild:Compile
- MSBuild:Compile
- Designer
-
-
- Designer
- MSBuild:Compile
- MSBuild:Compile
- Designer
-
-
- Designer
- MSBuild:Compile
- MSBuild:Compile
- Designer
-
-
- Designer
- MSBuild:Compile
- MSBuild:Compile
- Designer
-
-
- Designer
- MSBuild:Compile
- MSBuild:Compile
- Designer
-
-
- Designer
- MSBuild:Compile
- MSBuild:Compile
- Designer
-
-
- Designer
- MSBuild:Compile
- MSBuild:Compile
- Designer
-
-
- Designer
- MSBuild:Compile
- MSBuild:Compile
- Designer
-
-
- Designer
- MSBuild:Compile
- MSBuild:Compile
- Designer
-
-
- MSBuild:Compile
- Designer
- MSBuild:Compile
- Designer
-
-
- Code
- App.xaml
-
-
- Code
- ShowcaseWindow.xaml
-
-
-
-
-
-
-
- FancyBalloon.xaml
-
-
- FancyPopup.xaml
-
-
- Main.xaml
-
-
- Code
-
-
- True
- True
- Resources.resx
-
-
- True
- True
- Settings.settings
-
-
- SimpleWindowWithNotifyIcon.xaml
-
-
- SimpleUserControl.xaml
-
-
- InlineToolTipWindow.xaml
-
-
- UserControlToolTipWindow.xaml
-
-
- InlinePopupWindow.xaml
-
-
- InlineContextMenuWindow.xaml
-
-
- CommandWindow.xaml
-
-
-
- EventVisualizerWindow.xaml
-
-
- BalloonSampleWindow.xaml
-
-
- DataBoundToolTipWindow.xaml
-
-
- WelcomeBalloon.xaml
-
-
- ResXFileCodeGenerator
- Resources.Designer.cs
-
-
- SettingsSingleFileGenerator
- Settings.Designer.cs
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- False
- .NET Framework 3.5 SP1 Client Profile
- false
-
-
- False
- .NET Framework 3.5 SP1
- true
-
-
- False
- Windows Installer 3.1
- true
-
-
-
-
- {7AC63864-7638-41C4-969C-D3197EF2BED9}
- NotifyIconWpf
-
-
-
-
-
+
+
+
+ Debug
+ AnyCPU
+ 9.0.30729
+ 2.0
+ {71C74F29-F1C2-49C5-969F-C25AC4CDFCCC}
+ WinExe
+ Properties
+ Samples
+ Sample Project
+ v4.0
+ 512
+ {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ 4
+
+
+ 3.5
+
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
+ Client
+ 12.0.41002.1
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+ AllRules.ruleset
+ AnyCPU
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+ AllRules.ruleset
+
+
+
+ ClockPopup.xaml
+
+
+
+ MvvmSampleWindow.xaml
+
+
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+
+
+
+
+ 3.5
+
+
+
+
+ 3.5
+
+
+ 3.5
+
+
+
+
+ 3.0
+
+
+ 3.0
+
+
+ 3.0
+
+
+ 3.0
+
+
+
+
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+
+ FancyToolTip.xaml
+
+
+
+
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ Code
+ App.xaml
+
+
+ Code
+ ShowcaseWindow.xaml
+
+
+
+
+
+
+
+ FancyBalloon.xaml
+
+
+ FancyPopup.xaml
+
+
+ Main.xaml
+
+
+ Code
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ True
+ Settings.settings
+
+
+ SimpleWindowWithNotifyIcon.xaml
+
+
+ SimpleUserControl.xaml
+
+
+ InlineToolTipWindow.xaml
+
+
+ UserControlToolTipWindow.xaml
+
+
+ InlinePopupWindow.xaml
+
+
+ InlineContextMenuWindow.xaml
+
+
+ CommandWindow.xaml
+
+
+
+ EventVisualizerWindow.xaml
+
+
+ BalloonSampleWindow.xaml
+
+
+ DataBoundToolTipWindow.xaml
+
+
+ WelcomeBalloon.xaml
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ False
+ .NET Framework 3.5 SP1 Client Profile
+ false
+
+
+ False
+ .NET Framework 3.5 SP1
+ true
+
+
+ False
+ Windows Installer 3.1
+ true
+
+
+
+
+ {7AC63864-7638-41C4-969C-D3197EF2BED9}
+ NotifyIconWpf
+
+
+
+
+
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Showcase/FancyBalloon.xaml b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Showcase/FancyBalloon.xaml
index 734ce56..b5781ea 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Showcase/FancyBalloon.xaml
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Showcase/FancyBalloon.xaml
@@ -1,162 +1,162 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Showcase/FancyBalloon.xaml.cs b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Showcase/FancyBalloon.xaml.cs
index 2361cf0..8c72752 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Showcase/FancyBalloon.xaml.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Showcase/FancyBalloon.xaml.cs
@@ -1,107 +1,107 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Controls.Primitives;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Animation;
-using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
-using System.Windows.Shapes;
-using Hardcodet.Wpf.TaskbarNotification;
-
-namespace Samples
-{
- ///
- /// Interaction logic for FancyBalloon.xaml
- ///
- public partial class FancyBalloon : UserControl
- {
- private bool isClosing = false;
-
- #region BalloonText dependency property
-
- ///
- /// Description
- ///
- public static readonly DependencyProperty BalloonTextProperty =
- DependencyProperty.Register("BalloonText",
- typeof (string),
- typeof (FancyBalloon),
- new FrameworkPropertyMetadata(""));
-
- ///
- /// A property wrapper for the
- /// dependency property:
- /// Description
- ///
- public string BalloonText
- {
- get { return (string) GetValue(BalloonTextProperty); }
- set { SetValue(BalloonTextProperty, value); }
- }
-
- #endregion
-
- public FancyBalloon()
- {
- InitializeComponent();
- TaskbarIcon.AddBalloonClosingHandler(this, OnBalloonClosing);
- }
-
-
- ///
- /// By subscribing to the
- /// and setting the "Handled" property to true, we suppress the popup
- /// from being closed in order to display the custom fade-out animation.
- ///
- private void OnBalloonClosing(object sender, RoutedEventArgs e)
- {
- e.Handled = true; //suppresses the popup from being closed immediately
- isClosing = true;
- }
-
-
- ///
- /// Resolves the that displayed
- /// the balloon and requests a close action.
- ///
- private void imgClose_MouseDown(object sender, MouseButtonEventArgs e)
- {
- //the tray icon assigned this attached property to simplify access
- TaskbarIcon taskbarIcon = TaskbarIcon.GetParentTaskbarIcon(this);
- taskbarIcon.CloseBalloon();
- }
-
- ///
- /// If the users hovers over the balloon, we don't close it.
- ///
- private void grid_MouseEnter(object sender, MouseEventArgs e)
- {
- //if we're already running the fade-out animation, do not interrupt anymore
- //(makes things too complicated for the sample)
- if (isClosing) return;
-
- //the tray icon assigned this attached property to simplify access
- TaskbarIcon taskbarIcon = TaskbarIcon.GetParentTaskbarIcon(this);
- taskbarIcon.ResetBalloonCloseTimer();
- }
-
-
- ///
- /// Closes the popup once the fade-out animation completed.
- /// The animation was triggered in XAML through the attached
- /// BalloonClosing event.
- ///
- private void OnFadeOutCompleted(object sender, EventArgs e)
- {
- Popup pp = (Popup) Parent;
- pp.IsOpen = false;
- }
- }
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Animation;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+using Hardcodet.Wpf.TaskbarNotification;
+
+namespace Samples
+{
+ ///
+ /// Interaction logic for FancyBalloon.xaml
+ ///
+ public partial class FancyBalloon : UserControl
+ {
+ private bool isClosing = false;
+
+ #region BalloonText dependency property
+
+ ///
+ /// Description
+ ///
+ public static readonly DependencyProperty BalloonTextProperty =
+ DependencyProperty.Register("BalloonText",
+ typeof (string),
+ typeof (FancyBalloon),
+ new FrameworkPropertyMetadata(""));
+
+ ///
+ /// A property wrapper for the
+ /// dependency property:
+ /// Description
+ ///
+ public string BalloonText
+ {
+ get { return (string) GetValue(BalloonTextProperty); }
+ set { SetValue(BalloonTextProperty, value); }
+ }
+
+ #endregion
+
+ public FancyBalloon()
+ {
+ InitializeComponent();
+ TaskbarIcon.AddBalloonClosingHandler(this, OnBalloonClosing);
+ }
+
+
+ ///
+ /// By subscribing to the
+ /// and setting the "Handled" property to true, we suppress the popup
+ /// from being closed in order to display the custom fade-out animation.
+ ///
+ private void OnBalloonClosing(object sender, RoutedEventArgs e)
+ {
+ e.Handled = true; //suppresses the popup from being closed immediately
+ isClosing = true;
+ }
+
+
+ ///
+ /// Resolves the that displayed
+ /// the balloon and requests a close action.
+ ///
+ private void imgClose_MouseDown(object sender, MouseButtonEventArgs e)
+ {
+ //the tray icon assigned this attached property to simplify access
+ TaskbarIcon taskbarIcon = TaskbarIcon.GetParentTaskbarIcon(this);
+ taskbarIcon.CloseBalloon();
+ }
+
+ ///
+ /// If the users hovers over the balloon, we don't close it.
+ ///
+ private void grid_MouseEnter(object sender, MouseEventArgs e)
+ {
+ //if we're already running the fade-out animation, do not interrupt anymore
+ //(makes things too complicated for the sample)
+ if (isClosing) return;
+
+ //the tray icon assigned this attached property to simplify access
+ TaskbarIcon taskbarIcon = TaskbarIcon.GetParentTaskbarIcon(this);
+ taskbarIcon.ResetBalloonCloseTimer();
+ }
+
+
+ ///
+ /// Closes the popup once the fade-out animation completed.
+ /// The animation was triggered in XAML through the attached
+ /// BalloonClosing event.
+ ///
+ private void OnFadeOutCompleted(object sender, EventArgs e)
+ {
+ Popup pp = (Popup) Parent;
+ pp.IsOpen = false;
+ }
+ }
}
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Showcase/FancyPopup.xaml b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Showcase/FancyPopup.xaml
index efba38f..9e0f531 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Showcase/FancyPopup.xaml
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Showcase/FancyPopup.xaml
@@ -1,115 +1,115 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Showcase/FancyPopup.xaml.cs b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Showcase/FancyPopup.xaml.cs
index 636c716..d29c5de 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Showcase/FancyPopup.xaml.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Showcase/FancyPopup.xaml.cs
@@ -1,46 +1,46 @@
-using System.Windows;
-using System.Windows.Controls;
-
-namespace Samples
-{
- ///
- /// Interaction logic for FancyPopup.xaml
- ///
- public partial class FancyPopup : UserControl
- {
- #region ClickCount dependency property
-
- ///
- /// The number of clicks on the popup button.
- ///
- public static readonly DependencyProperty ClickCountProperty =
- DependencyProperty.Register("ClickCount",
- typeof (int),
- typeof (FancyPopup),
- new FrameworkPropertyMetadata(0));
-
- ///
- /// A property wrapper for the
- /// dependency property:
- /// The number of clicks on the popup button.
- ///
- public int ClickCount
- {
- get { return (int) GetValue(ClickCountProperty); }
- set { SetValue(ClickCountProperty, value); }
- }
-
- #endregion
-
- public FancyPopup()
- {
- InitializeComponent();
- }
-
- private void OnButtonClick(object sender, RoutedEventArgs e)
- {
- //just increment a counter - will be displayed on screen
- ClickCount++;
- }
- }
+using System.Windows;
+using System.Windows.Controls;
+
+namespace Samples
+{
+ ///
+ /// Interaction logic for FancyPopup.xaml
+ ///
+ public partial class FancyPopup : UserControl
+ {
+ #region ClickCount dependency property
+
+ ///
+ /// The number of clicks on the popup button.
+ ///
+ public static readonly DependencyProperty ClickCountProperty =
+ DependencyProperty.Register("ClickCount",
+ typeof (int),
+ typeof (FancyPopup),
+ new FrameworkPropertyMetadata(0));
+
+ ///
+ /// A property wrapper for the
+ /// dependency property:
+ /// The number of clicks on the popup button.
+ ///
+ public int ClickCount
+ {
+ get { return (int) GetValue(ClickCountProperty); }
+ set { SetValue(ClickCountProperty, value); }
+ }
+
+ #endregion
+
+ public FancyPopup()
+ {
+ InitializeComponent();
+ }
+
+ private void OnButtonClick(object sender, RoutedEventArgs e)
+ {
+ //just increment a counter - will be displayed on screen
+ ClickCount++;
+ }
+ }
}
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Showcase/FancyToolTip.xaml b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Showcase/FancyToolTip.xaml
index 0e42d0b..9392e7b 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Showcase/FancyToolTip.xaml
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Showcase/FancyToolTip.xaml
@@ -1,114 +1,114 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Showcase/FancyToolTip.xaml.cs b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Showcase/FancyToolTip.xaml.cs
index 5609d6a..f8757e2 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Showcase/FancyToolTip.xaml.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Showcase/FancyToolTip.xaml.cs
@@ -1,51 +1,51 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
-using System.Windows.Shapes;
-using Hardcodet.Wpf.TaskbarNotification;
-
-namespace Samples
-{
- ///
- /// Interaction logic for FancyToolTip.xaml
- ///
- public partial class FancyToolTip
- {
- #region InfoText dependency property
-
- ///
- /// The tooltip details.
- ///
- public static readonly DependencyProperty InfoTextProperty =
- DependencyProperty.Register("InfoText",
- typeof (string),
- typeof (FancyToolTip),
- new FrameworkPropertyMetadata(""));
-
- ///
- /// A property wrapper for the
- /// dependency property:
- /// The tooltip details.
- ///
- public string InfoText
- {
- get { return (string) GetValue(InfoTextProperty); }
- set { SetValue(InfoTextProperty, value); }
- }
-
- #endregion
-
- public FancyToolTip()
- {
- this.InitializeComponent();
- }
- }
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+using Hardcodet.Wpf.TaskbarNotification;
+
+namespace Samples
+{
+ ///
+ /// Interaction logic for FancyToolTip.xaml
+ ///
+ public partial class FancyToolTip
+ {
+ #region InfoText dependency property
+
+ ///
+ /// The tooltip details.
+ ///
+ public static readonly DependencyProperty InfoTextProperty =
+ DependencyProperty.Register("InfoText",
+ typeof (string),
+ typeof (FancyToolTip),
+ new FrameworkPropertyMetadata(""));
+
+ ///
+ /// A property wrapper for the
+ /// dependency property:
+ /// The tooltip details.
+ ///
+ public string InfoText
+ {
+ get { return (string) GetValue(InfoTextProperty); }
+ set { SetValue(InfoTextProperty, value); }
+ }
+
+ #endregion
+
+ public FancyToolTip()
+ {
+ this.InitializeComponent();
+ }
+ }
}
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Showcase/NotifyIconResources.xaml b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Showcase/NotifyIconResources.xaml
index 2f0a526..46bf6be 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Showcase/NotifyIconResources.xaml
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Showcase/NotifyIconResources.xaml
@@ -1,81 +1,81 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Showcase/ShowcaseWindow.xaml b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Showcase/ShowcaseWindow.xaml
index c4fa802..5e19f35 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Showcase/ShowcaseWindow.xaml
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Showcase/ShowcaseWindow.xaml
@@ -1,640 +1,640 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- WPF NotifyIcon
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ WPF NotifyIcon
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Showcase/ShowcaseWindow.xaml.cs b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Showcase/ShowcaseWindow.xaml.cs
index a4d9558..804e69e 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Showcase/ShowcaseWindow.xaml.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Showcase/ShowcaseWindow.xaml.cs
@@ -1,92 +1,92 @@
-using System.Diagnostics;
-using System.Windows;
-using System.Windows.Controls.Primitives;
-using System.Windows.Navigation;
-using Hardcodet.Wpf.TaskbarNotification;
-
-namespace Samples
-{
- ///
- /// Interaction logic for ShowcaseWindow.xaml
- ///
- public partial class ShowcaseWindow : Window
- {
- public ShowcaseWindow()
- {
- InitializeComponent();
-
-
- Loaded += delegate
- {
- //show balloon at startup
- var balloon = new WelcomeBalloon();
- tb.ShowCustomBalloon(balloon, PopupAnimation.Slide, 12000);
- };
- }
-
-
- ///
- /// Displays a balloon tip.
- ///
- private void showBalloonTip_Click(object sender, RoutedEventArgs e)
- {
- string title = txtBalloonTitle.Text;
- string message = txtBalloonText.Text;
-
- if (rbCustomIcon.IsChecked == true)
- {
- //just display the icon on the tray
- var icon = tb.Icon;
- tb.ShowBalloonTip(title, message, icon);
- }
- else
- {
- 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);
- }
-
- private void hideCustomBalloon_Click(object sender, RoutedEventArgs e)
- {
- tb.CloseBalloon();
- }
-
-
- private void OnNavigationRequest(object sender, RequestNavigateEventArgs e)
- {
- Process.Start(e.Uri.ToString());
- e.Handled = true;
- }
-
-
- protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
- {
- //clean up notifyicon (would otherwise stay open until application finishes)
- tb.Dispose();
- base.OnClosing(e);
- }
- }
+using System.Diagnostics;
+using System.Windows;
+using System.Windows.Controls.Primitives;
+using System.Windows.Navigation;
+using Hardcodet.Wpf.TaskbarNotification;
+
+namespace Samples
+{
+ ///
+ /// Interaction logic for ShowcaseWindow.xaml
+ ///
+ public partial class ShowcaseWindow : Window
+ {
+ public ShowcaseWindow()
+ {
+ InitializeComponent();
+
+
+ Loaded += delegate
+ {
+ //show balloon at startup
+ var balloon = new WelcomeBalloon();
+ tb.ShowCustomBalloon(balloon, PopupAnimation.Slide, 12000);
+ };
+ }
+
+
+ ///
+ /// Displays a balloon tip.
+ ///
+ private void showBalloonTip_Click(object sender, RoutedEventArgs e)
+ {
+ string title = txtBalloonTitle.Text;
+ string message = txtBalloonText.Text;
+
+ if (rbCustomIcon.IsChecked == true)
+ {
+ //just display the icon on the tray
+ var icon = tb.Icon;
+ tb.ShowBalloonTip(title, message, icon);
+ }
+ else
+ {
+ 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);
+ }
+
+ private void hideCustomBalloon_Click(object sender, RoutedEventArgs e)
+ {
+ tb.CloseBalloon();
+ }
+
+
+ private void OnNavigationRequest(object sender, RequestNavigateEventArgs e)
+ {
+ Process.Start(e.Uri.ToString());
+ e.Handled = true;
+ }
+
+
+ protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
+ {
+ //clean up notifyicon (would otherwise stay open until application finishes)
+ tb.Dispose();
+ base.OnClosing(e);
+ }
+ }
}
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Showcase/WelcomeBalloon.xaml b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Showcase/WelcomeBalloon.xaml
index c81255a..e0d33c2 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Showcase/WelcomeBalloon.xaml
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Showcase/WelcomeBalloon.xaml
@@ -1,105 +1,105 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Showcase/WelcomeBalloon.xaml.cs b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Showcase/WelcomeBalloon.xaml.cs
index 10354aa..90682de 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Showcase/WelcomeBalloon.xaml.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Showcase/WelcomeBalloon.xaml.cs
@@ -1,27 +1,27 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
-using System.Windows.Shapes;
-
-namespace Samples
-{
- ///
- /// Interaction logic for WelcomeBalloon.xaml
- ///
- public partial class WelcomeBalloon : UserControl
- {
- public WelcomeBalloon()
- {
- InitializeComponent();
- }
- }
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace Samples
+{
+ ///
+ /// Interaction logic for WelcomeBalloon.xaml
+ ///
+ public partial class WelcomeBalloon : UserControl
+ {
+ public WelcomeBalloon()
+ {
+ InitializeComponent();
+ }
+ }
}
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/01 - Declaration/NotifyIconResourceDictionary.xaml b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/01 - Declaration/NotifyIconResourceDictionary.xaml
index 021457e..e53834a 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/01 - Declaration/NotifyIconResourceDictionary.xaml
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/01 - Declaration/NotifyIconResourceDictionary.xaml
@@ -1,10 +1,10 @@
-
-
-
-
-
+
+
+
+
+
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/01 - Declaration/SimpleWindowWithNotifyIcon.xaml b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/01 - Declaration/SimpleWindowWithNotifyIcon.xaml
index acc53fe..22234fa 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/01 - Declaration/SimpleWindowWithNotifyIcon.xaml
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/01 - Declaration/SimpleWindowWithNotifyIcon.xaml
@@ -1,20 +1,20 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/01 - Declaration/SimpleWindowWithNotifyIcon.xaml.cs b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/01 - Declaration/SimpleWindowWithNotifyIcon.xaml.cs
index e6fdb03..f6fc049 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/01 - Declaration/SimpleWindowWithNotifyIcon.xaml.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/01 - Declaration/SimpleWindowWithNotifyIcon.xaml.cs
@@ -1,23 +1,23 @@
-using System.Windows;
-
-namespace Samples.Tutorials
-{
- ///
- /// Interaction logic for SimpleWindowWithNotifyIcon.xaml
- ///
- public partial class SimpleWindowWithNotifyIcon : Window
- {
- public SimpleWindowWithNotifyIcon()
- {
- InitializeComponent();
- }
-
- protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
- {
- //clean up notifyicon (would otherwise stay open until application finishes)
- MyNotifyIcon.Dispose();
-
- base.OnClosing(e);
- }
- }
+using System.Windows;
+
+namespace Samples.Tutorials
+{
+ ///
+ /// Interaction logic for SimpleWindowWithNotifyIcon.xaml
+ ///
+ public partial class SimpleWindowWithNotifyIcon : Window
+ {
+ public SimpleWindowWithNotifyIcon()
+ {
+ InitializeComponent();
+ }
+
+ protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
+ {
+ //clean up notifyicon (would otherwise stay open until application finishes)
+ MyNotifyIcon.Dispose();
+
+ base.OnClosing(e);
+ }
+ }
}
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/02 - ToolTips/InlineToolTipWindow.xaml b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/02 - ToolTips/InlineToolTipWindow.xaml
index c6b9d14..d7a0905 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/02 - ToolTips/InlineToolTipWindow.xaml
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/02 - ToolTips/InlineToolTipWindow.xaml
@@ -1,41 +1,41 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/02 - ToolTips/InlineToolTipWindow.xaml.cs b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/02 - ToolTips/InlineToolTipWindow.xaml.cs
index f136b35..a953b19 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/02 - ToolTips/InlineToolTipWindow.xaml.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/02 - ToolTips/InlineToolTipWindow.xaml.cs
@@ -1,34 +1,34 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Shapes;
-
-namespace Samples.Tutorials.ToolTips
-{
- ///
- /// Interaction logic for Window1.xaml
- ///
- public partial class InlineToolTipWindow : Window
- {
- public InlineToolTipWindow()
- {
- InitializeComponent();
- }
-
- protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
- {
- //clean up notifyicon (would otherwise stay open until application finishes)
- MyNotifyIcon.Dispose();
-
- base.OnClosing(e);
- }
- }
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace Samples.Tutorials.ToolTips
+{
+ ///
+ /// Interaction logic for Window1.xaml
+ ///
+ public partial class InlineToolTipWindow : Window
+ {
+ public InlineToolTipWindow()
+ {
+ InitializeComponent();
+ }
+
+ protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
+ {
+ //clean up notifyicon (would otherwise stay open until application finishes)
+ MyNotifyIcon.Dispose();
+
+ base.OnClosing(e);
+ }
+ }
}
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/02 - ToolTips/SimpleUserControl.xaml b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/02 - ToolTips/SimpleUserControl.xaml
index 079cb11..9af48b3 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/02 - ToolTips/SimpleUserControl.xaml
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/02 - ToolTips/SimpleUserControl.xaml
@@ -1,21 +1,21 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/02 - ToolTips/SimpleUserControl.xaml.cs b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/02 - ToolTips/SimpleUserControl.xaml.cs
index 3b8e953..56af7f1 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/02 - ToolTips/SimpleUserControl.xaml.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/02 - ToolTips/SimpleUserControl.xaml.cs
@@ -1,27 +1,27 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
-using System.Windows.Shapes;
-
-namespace Samples.Tutorials.ToolTips
-{
- ///
- /// Interaction logic for SimpleUserControl.xaml
- ///
- public partial class SimpleUserControl : UserControl
- {
- public SimpleUserControl()
- {
- InitializeComponent();
- }
- }
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace Samples.Tutorials.ToolTips
+{
+ ///
+ /// Interaction logic for SimpleUserControl.xaml
+ ///
+ public partial class SimpleUserControl : UserControl
+ {
+ public SimpleUserControl()
+ {
+ InitializeComponent();
+ }
+ }
}
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/02 - ToolTips/UserControlToolTipWindow.xaml b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/02 - ToolTips/UserControlToolTipWindow.xaml
index 3aed554..cac983b 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/02 - ToolTips/UserControlToolTipWindow.xaml
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/02 - ToolTips/UserControlToolTipWindow.xaml
@@ -1,27 +1,27 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/02 - ToolTips/UserControlToolTipWindow.xaml.cs b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/02 - ToolTips/UserControlToolTipWindow.xaml.cs
index ce31c19..b6da22a 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/02 - ToolTips/UserControlToolTipWindow.xaml.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/02 - ToolTips/UserControlToolTipWindow.xaml.cs
@@ -1,34 +1,34 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Shapes;
-
-namespace Samples.Tutorials.ToolTips
-{
- ///
- /// Interaction logic for UserControlToolTipWindow.xaml
- ///
- public partial class UserControlToolTipWindow : Window
- {
- public UserControlToolTipWindow()
- {
- InitializeComponent();
- }
-
- protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
- {
- //clean up notifyicon (would otherwise stay open until application finishes)
- MyNotifyIcon.Dispose();
-
- base.OnClosing(e);
- }
- }
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace Samples.Tutorials.ToolTips
+{
+ ///
+ /// Interaction logic for UserControlToolTipWindow.xaml
+ ///
+ public partial class UserControlToolTipWindow : Window
+ {
+ public UserControlToolTipWindow()
+ {
+ InitializeComponent();
+ }
+
+ protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
+ {
+ //clean up notifyicon (would otherwise stay open until application finishes)
+ MyNotifyIcon.Dispose();
+
+ base.OnClosing(e);
+ }
+ }
}
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/03 - Popups/InlinePopupWindow.xaml b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/03 - Popups/InlinePopupWindow.xaml
index 9645b30..d67aca8 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/03 - Popups/InlinePopupWindow.xaml
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/03 - Popups/InlinePopupWindow.xaml
@@ -1,61 +1,61 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/03 - Popups/InlinePopupWindow.xaml.cs b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/03 - Popups/InlinePopupWindow.xaml.cs
index 5f69409..b08a4f2 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/03 - Popups/InlinePopupWindow.xaml.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/03 - Popups/InlinePopupWindow.xaml.cs
@@ -1,34 +1,34 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Shapes;
-
-namespace Samples.Tutorials.Popups
-{
- ///
- /// Interaction logic for InlinePopupWindow.xaml
- ///
- public partial class InlinePopupWindow : Window
- {
- public InlinePopupWindow()
- {
- InitializeComponent();
- }
-
- protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
- {
- //clean up notifyicon (would otherwise stay open until application finishes)
- MyNotifyIcon.Dispose();
-
- base.OnClosing(e);
- }
- }
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace Samples.Tutorials.Popups
+{
+ ///
+ /// Interaction logic for InlinePopupWindow.xaml
+ ///
+ public partial class InlinePopupWindow : Window
+ {
+ public InlinePopupWindow()
+ {
+ InitializeComponent();
+ }
+
+ protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
+ {
+ //clean up notifyicon (would otherwise stay open until application finishes)
+ MyNotifyIcon.Dispose();
+
+ base.OnClosing(e);
+ }
+ }
}
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/04 - ContextMenus/InlineContextMenuWindow.xaml b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/04 - ContextMenus/InlineContextMenuWindow.xaml
index 1cd92ea..9cebe09 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/04 - ContextMenus/InlineContextMenuWindow.xaml
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/04 - ContextMenus/InlineContextMenuWindow.xaml
@@ -1,81 +1,81 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/04 - ContextMenus/InlineContextMenuWindow.xaml.cs b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/04 - ContextMenus/InlineContextMenuWindow.xaml.cs
index ad5186f..5fa550d 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/04 - ContextMenus/InlineContextMenuWindow.xaml.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/04 - ContextMenus/InlineContextMenuWindow.xaml.cs
@@ -1,40 +1,40 @@
-using System.Diagnostics;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Input;
-
-namespace Samples.Tutorials.ContextMenus
-{
- ///
- /// Interaction logic for InlineContextMenuWindow.xaml
- ///
- public partial class InlineContextMenuWindow : Window
- {
- public InlineContextMenuWindow()
- {
- InitializeComponent();
- }
-
-
- protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
- {
- //clean up notifyicon (would otherwise stay open until application finishes)
- MyNotifyIcon.Dispose();
-
- base.OnClosing(e);
- }
-
- private void MyNotifyIcon_TrayContextMenuOpen(object sender, System.Windows.RoutedEventArgs e)
- {
- OpenEventCounter.Text = (int.Parse(OpenEventCounter.Text) + 1).ToString();
- }
-
- private void MyNotifyIcon_PreviewTrayContextMenuOpen(object sender, System.Windows.RoutedEventArgs e)
- {
- //marking the event as handled suppresses the context menu
- e.Handled = (bool) SuppressContextMenu.IsChecked;
-
- PreviewOpenEventCounter.Text = (int.Parse(PreviewOpenEventCounter.Text) + 1).ToString();
- }
- }
+using System.Diagnostics;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Input;
+
+namespace Samples.Tutorials.ContextMenus
+{
+ ///
+ /// Interaction logic for InlineContextMenuWindow.xaml
+ ///
+ public partial class InlineContextMenuWindow : Window
+ {
+ public InlineContextMenuWindow()
+ {
+ InitializeComponent();
+ }
+
+
+ protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
+ {
+ //clean up notifyicon (would otherwise stay open until application finishes)
+ MyNotifyIcon.Dispose();
+
+ base.OnClosing(e);
+ }
+
+ private void MyNotifyIcon_TrayContextMenuOpen(object sender, System.Windows.RoutedEventArgs e)
+ {
+ OpenEventCounter.Text = (int.Parse(OpenEventCounter.Text) + 1).ToString();
+ }
+
+ private void MyNotifyIcon_PreviewTrayContextMenuOpen(object sender, System.Windows.RoutedEventArgs e)
+ {
+ //marking the event as handled suppresses the context menu
+ e.Handled = (bool) SuppressContextMenu.IsChecked;
+
+ PreviewOpenEventCounter.Text = (int.Parse(PreviewOpenEventCounter.Text) + 1).ToString();
+ }
+ }
}
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/05 - Balloons/BalloonSampleWindow.xaml b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/05 - Balloons/BalloonSampleWindow.xaml
index 002ba8a..de700d2 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/05 - Balloons/BalloonSampleWindow.xaml
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/05 - Balloons/BalloonSampleWindow.xaml
@@ -1,51 +1,51 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/05 - Balloons/BalloonSampleWindow.xaml.cs b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/05 - Balloons/BalloonSampleWindow.xaml.cs
index 02a960b..5e663cb 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/05 - Balloons/BalloonSampleWindow.xaml.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/05 - Balloons/BalloonSampleWindow.xaml.cs
@@ -1,65 +1,65 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Controls.Primitives;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Shapes;
-using Hardcodet.Wpf.TaskbarNotification;
-
-namespace Samples.Tutorials.Balloons
-{
- ///
- /// Interaction logic for BalloonSampleWindow.xaml
- ///
- public partial class BalloonSampleWindow : Window
- {
- public BalloonSampleWindow()
- {
- InitializeComponent();
- }
-
- protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
- {
- //clean up notifyicon (would otherwise stay open until application finishes)
- MyNotifyIcon.Dispose();
-
- base.OnClosing(e);
- }
-
-
- private void btnShowCustomBalloon_Click(object sender, RoutedEventArgs e)
- {
- FancyBalloon balloon = new FancyBalloon();
- balloon.BalloonText = "Custom Balloon";
-
- //show balloon and close it after 4 seconds
- MyNotifyIcon.ShowCustomBalloon(balloon, PopupAnimation.Slide, 4000);
- }
-
- private void btnHideStandardBalloon_Click(object sender, RoutedEventArgs e)
- {
- MyNotifyIcon.HideBalloonTip();
- }
-
-
- private void btnShowStandardBalloon_Click(object sender, RoutedEventArgs e)
- {
- string title = "WPF NotifyIcon";
- string text = "This is a standard balloon";
-
- MyNotifyIcon.ShowBalloonTip(title, text, MyNotifyIcon.Icon);
- }
-
- private void btnCloseCustomBalloon_Click(object sender, RoutedEventArgs e)
- {
- MyNotifyIcon.CloseBalloon();
- }
- }
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+using Hardcodet.Wpf.TaskbarNotification;
+
+namespace Samples.Tutorials.Balloons
+{
+ ///
+ /// Interaction logic for BalloonSampleWindow.xaml
+ ///
+ public partial class BalloonSampleWindow : Window
+ {
+ public BalloonSampleWindow()
+ {
+ InitializeComponent();
+ }
+
+ protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
+ {
+ //clean up notifyicon (would otherwise stay open until application finishes)
+ MyNotifyIcon.Dispose();
+
+ base.OnClosing(e);
+ }
+
+
+ private void btnShowCustomBalloon_Click(object sender, RoutedEventArgs e)
+ {
+ FancyBalloon balloon = new FancyBalloon();
+ balloon.BalloonText = "Custom Balloon";
+
+ //show balloon and close it after 4 seconds
+ MyNotifyIcon.ShowCustomBalloon(balloon, PopupAnimation.Slide, 4000);
+ }
+
+ private void btnHideStandardBalloon_Click(object sender, RoutedEventArgs e)
+ {
+ MyNotifyIcon.HideBalloonTip();
+ }
+
+
+ private void btnShowStandardBalloon_Click(object sender, RoutedEventArgs e)
+ {
+ string title = "WPF NotifyIcon";
+ string text = "This is a standard balloon";
+
+ MyNotifyIcon.ShowBalloonTip(title, text, MyNotifyIcon.Icon);
+ }
+
+ private void btnCloseCustomBalloon_Click(object sender, RoutedEventArgs e)
+ {
+ MyNotifyIcon.CloseBalloon();
+ }
+ }
}
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/06 - Commands/CommandWindow.xaml b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/06 - Commands/CommandWindow.xaml
index 860d402..0c90dfd 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/06 - Commands/CommandWindow.xaml
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/06 - Commands/CommandWindow.xaml
@@ -1,64 +1,64 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/06 - Commands/CommandWindow.xaml.cs b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/06 - Commands/CommandWindow.xaml.cs
index 9810702..b83705d 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/06 - Commands/CommandWindow.xaml.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/06 - Commands/CommandWindow.xaml.cs
@@ -1,36 +1,36 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Shapes;
-
-namespace Samples.Tutorials.Commands
-{
- ///
- /// Interaction logic for CommandWindow.xaml
- ///
- public partial class CommandWindow : Window
- {
- public CommandWindow()
- {
- InitializeComponent();
- }
-
-
- protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
- {
- //clean up notifyicon (would otherwise stay open until application finishes)
- CustomCommandNotifyIcon.Dispose();
- RoutedCommandNotifyIcon.Dispose();
-
- base.OnClosing(e);
- }
- }
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace Samples.Tutorials.Commands
+{
+ ///
+ /// Interaction logic for CommandWindow.xaml
+ ///
+ public partial class CommandWindow : Window
+ {
+ public CommandWindow()
+ {
+ InitializeComponent();
+ }
+
+
+ protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
+ {
+ //clean up notifyicon (would otherwise stay open until application finishes)
+ CustomCommandNotifyIcon.Dispose();
+ RoutedCommandNotifyIcon.Dispose();
+
+ base.OnClosing(e);
+ }
+ }
}
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/06 - Commands/ShowMessageCommand.cs b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/06 - Commands/ShowMessageCommand.cs
index 4c2325c..9ad382a 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/06 - Commands/ShowMessageCommand.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/06 - Commands/ShowMessageCommand.cs
@@ -1,25 +1,25 @@
-using System;
-using System.Windows;
-using System.Windows.Input;
-
-namespace Samples.Tutorials.Commands
-{
- ///
- /// A simple command that displays the command parameter as
- /// a dialog message.
- ///
- public class ShowMessageCommand : ICommand
- {
- public void Execute(object parameter)
- {
- MessageBox.Show(parameter.ToString());
- }
-
- public bool CanExecute(object parameter)
- {
- return true;
- }
-
- public event EventHandler CanExecuteChanged;
- }
+using System;
+using System.Windows;
+using System.Windows.Input;
+
+namespace Samples.Tutorials.Commands
+{
+ ///
+ /// A simple command that displays the command parameter as
+ /// a dialog message.
+ ///
+ public class ShowMessageCommand : ICommand
+ {
+ public void Execute(object parameter)
+ {
+ MessageBox.Show(parameter.ToString());
+ }
+
+ public bool CanExecute(object parameter)
+ {
+ return true;
+ }
+
+ public event EventHandler CanExecuteChanged;
+ }
}
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/07 - Events/EventVisualizerWindow.xaml b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/07 - Events/EventVisualizerWindow.xaml
index 336bad4..b179b3d 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/07 - Events/EventVisualizerWindow.xaml
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/07 - Events/EventVisualizerWindow.xaml
@@ -1,265 +1,265 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/07 - Events/EventVisualizerWindow.xaml.cs b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/07 - Events/EventVisualizerWindow.xaml.cs
index ae05796..e8073bc 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/07 - Events/EventVisualizerWindow.xaml.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/07 - Events/EventVisualizerWindow.xaml.cs
@@ -1,24 +1,24 @@
-using System.Windows;
-
-namespace Samples.Tutorials.Events
-{
- ///
- /// Interaction logic for EventVisualizerWindow.xaml
- ///
- public partial class EventVisualizerWindow : Window
- {
- public EventVisualizerWindow()
- {
- InitializeComponent();
- }
-
-
- protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
- {
- //clean up notifyicon (would otherwise stay open until application finishes)
- notifyIcon.Dispose();
-
- base.OnClosing(e);
- }
- }
+using System.Windows;
+
+namespace Samples.Tutorials.Events
+{
+ ///
+ /// Interaction logic for EventVisualizerWindow.xaml
+ ///
+ public partial class EventVisualizerWindow : Window
+ {
+ public EventVisualizerWindow()
+ {
+ InitializeComponent();
+ }
+
+
+ protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
+ {
+ //clean up notifyicon (would otherwise stay open until application finishes)
+ notifyIcon.Dispose();
+
+ base.OnClosing(e);
+ }
+ }
}
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/08 - DataBinding/DataBoundToolTipWindow.xaml b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/08 - DataBinding/DataBoundToolTipWindow.xaml
index 8dc64f8..0f72e92 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/08 - DataBinding/DataBoundToolTipWindow.xaml
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/08 - DataBinding/DataBoundToolTipWindow.xaml
@@ -1,91 +1,91 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/08 - DataBinding/DataBoundToolTipWindow.xaml.cs b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/08 - DataBinding/DataBoundToolTipWindow.xaml.cs
index 8568061..bbe5d88 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/08 - DataBinding/DataBoundToolTipWindow.xaml.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/08 - DataBinding/DataBoundToolTipWindow.xaml.cs
@@ -1,25 +1,25 @@
-using System.Windows;
-
-namespace Samples.Tutorials.DataBinding
-{
- ///
- /// Interaction logic for DataBoundToolTipWindow.xaml
- ///
- public partial class DataBoundToolTipWindow : Window
- {
- public DataBoundToolTipWindow()
- {
- InitializeComponent();
- }
-
-
- protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
- {
- //clean up notifyicon (would otherwise stay open until application finishes)
- MyNotifyIcon1.Dispose();
- MyNotifyIcon2.Dispose();
-
- base.OnClosing(e);
- }
- }
+using System.Windows;
+
+namespace Samples.Tutorials.DataBinding
+{
+ ///
+ /// Interaction logic for DataBoundToolTipWindow.xaml
+ ///
+ public partial class DataBoundToolTipWindow : Window
+ {
+ public DataBoundToolTipWindow()
+ {
+ InitializeComponent();
+ }
+
+
+ protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
+ {
+ //clean up notifyicon (would otherwise stay open until application finishes)
+ MyNotifyIcon1.Dispose();
+ MyNotifyIcon2.Dispose();
+
+ base.OnClosing(e);
+ }
+ }
}
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/09 - MVVM/ClockPopup.xaml b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/09 - MVVM/ClockPopup.xaml
index 3c357a2..a8565b2 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/09 - MVVM/ClockPopup.xaml
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/09 - MVVM/ClockPopup.xaml
@@ -1,37 +1,37 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/09 - MVVM/ClockPopup.xaml.cs b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/09 - MVVM/ClockPopup.xaml.cs
index 7dd1cb4..063d0b6 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/09 - MVVM/ClockPopup.xaml.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/09 - MVVM/ClockPopup.xaml.cs
@@ -1,15 +1,15 @@
-using System.Windows.Controls;
-
-namespace Samples.Tutorials.MvvmSample
-{
- ///
- /// Interaction logic for ClockPopup.xaml
- ///
- public partial class ClockPopup : UserControl
- {
- public ClockPopup()
- {
- this.InitializeComponent();
- }
- }
+using System.Windows.Controls;
+
+namespace Samples.Tutorials.MvvmSample
+{
+ ///
+ /// Interaction logic for ClockPopup.xaml
+ ///
+ public partial class ClockPopup : UserControl
+ {
+ public ClockPopup()
+ {
+ this.InitializeComponent();
+ }
+ }
}
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/09 - MVVM/MvvmSampleViewModel.cs b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/09 - MVVM/MvvmSampleViewModel.cs
index f1bd834..e3fc20a 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/09 - MVVM/MvvmSampleViewModel.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/09 - MVVM/MvvmSampleViewModel.cs
@@ -1,38 +1,38 @@
-using System;
-using System.ComponentModel;
-using System.Windows;
-using System.Windows.Threading;
-
-namespace Samples.Tutorials.MvvmSample
-{
- public class MvvmSampleViewModel : INotifyPropertyChanged
- {
- private DispatcherTimer timer;
-
- public string Timestamp
- {
- get { return DateTime.Now.ToLongTimeString(); }
- }
-
-
- public MvvmSampleViewModel()
- {
- timer = new DispatcherTimer(TimeSpan.FromSeconds(1), DispatcherPriority.Normal, OnTimerTick, Application.Current.Dispatcher);
- }
-
- private void OnTimerTick(object sender, EventArgs e)
- {
- //fire a property change event for the timestamp
- Application.Current.Dispatcher.BeginInvoke(new Action(() => OnPropertyChanged("Timestamp")));
- }
-
- public event PropertyChangedEventHandler PropertyChanged;
-
- protected virtual void OnPropertyChanged(string propertyName)
- {
- PropertyChangedEventHandler handler = PropertyChanged;
- if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
- }
- }
-}
+using System;
+using System.ComponentModel;
+using System.Windows;
+using System.Windows.Threading;
+
+namespace Samples.Tutorials.MvvmSample
+{
+ public class MvvmSampleViewModel : INotifyPropertyChanged
+ {
+ private DispatcherTimer timer;
+
+ public string Timestamp
+ {
+ get { return DateTime.Now.ToLongTimeString(); }
+ }
+
+
+ public MvvmSampleViewModel()
+ {
+ timer = new DispatcherTimer(TimeSpan.FromSeconds(1), DispatcherPriority.Normal, OnTimerTick, Application.Current.Dispatcher);
+ }
+
+ private void OnTimerTick(object sender, EventArgs e)
+ {
+ //fire a property change event for the timestamp
+ Application.Current.Dispatcher.BeginInvoke(new Action(() => OnPropertyChanged("Timestamp")));
+ }
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ protected virtual void OnPropertyChanged(string propertyName)
+ {
+ PropertyChangedEventHandler handler = PropertyChanged;
+ if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
+ }
+ }
+}
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/09 - MVVM/MvvmSampleWindow.xaml b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/09 - MVVM/MvvmSampleWindow.xaml
index d73a3e2..d3d5bc5 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/09 - MVVM/MvvmSampleWindow.xaml
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/09 - MVVM/MvvmSampleWindow.xaml
@@ -1,37 +1,37 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/09 - MVVM/MvvmSampleWindow.xaml.cs b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/09 - MVVM/MvvmSampleWindow.xaml.cs
index 89876f8..a756919 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/09 - MVVM/MvvmSampleWindow.xaml.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/09 - MVVM/MvvmSampleWindow.xaml.cs
@@ -1,15 +1,15 @@
-using System.Windows;
-
-namespace Samples.Tutorials.MvvmSample
-{
- ///
- /// Interaction logic for MvvmSampleWindow.xaml
- ///
- public partial class MvvmSampleWindow : Window
- {
- public MvvmSampleWindow()
- {
- InitializeComponent();
- }
- }
-}
+using System.Windows;
+
+namespace Samples.Tutorials.MvvmSample
+{
+ ///
+ /// Interaction logic for MvvmSampleWindow.xaml
+ ///
+ public partial class MvvmSampleWindow : Window
+ {
+ public MvvmSampleWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Windowless Sample/App.xaml b/Hardcodet.NotifyIcon.Wpf/Source/Windowless Sample/App.xaml
index 5417c0a..8c5e604 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Windowless Sample/App.xaml
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Windowless Sample/App.xaml
@@ -1,21 +1,21 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Windowless Sample/App.xaml.cs b/Hardcodet.NotifyIcon.Wpf/Source/Windowless Sample/App.xaml.cs
index e36f2e6..8ecc907 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Windowless Sample/App.xaml.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Windowless Sample/App.xaml.cs
@@ -1,27 +1,27 @@
-using System.Windows;
-using Hardcodet.Wpf.TaskbarNotification;
-
-namespace Windowless_Sample
-{
- ///
- /// Simple application. Check the XAML for comments.
- ///
- public partial class App : Application
- {
- private TaskbarIcon notifyIcon;
-
- protected override void OnStartup(StartupEventArgs e)
- {
- base.OnStartup(e);
-
- //create the notifyicon (it's a resource declared in NotifyIconResources.xaml
- notifyIcon = (TaskbarIcon) FindResource("NotifyIcon");
- }
-
- protected override void OnExit(ExitEventArgs e)
- {
- notifyIcon.Dispose(); //the icon would clean up automatically, but this is cleaner
- base.OnExit(e);
- }
- }
-}
+using System.Windows;
+using Hardcodet.Wpf.TaskbarNotification;
+
+namespace Windowless_Sample
+{
+ ///
+ /// Simple application. Check the XAML for comments.
+ ///
+ public partial class App : Application
+ {
+ private TaskbarIcon notifyIcon;
+
+ protected override void OnStartup(StartupEventArgs e)
+ {
+ base.OnStartup(e);
+
+ //create the notifyicon (it's a resource declared in NotifyIconResources.xaml
+ notifyIcon = (TaskbarIcon) FindResource("NotifyIcon");
+ }
+
+ protected override void OnExit(ExitEventArgs e)
+ {
+ notifyIcon.Dispose(); //the icon would clean up automatically, but this is cleaner
+ base.OnExit(e);
+ }
+ }
+}
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Windowless Sample/MainWindow.xaml b/Hardcodet.NotifyIcon.Wpf/Source/Windowless Sample/MainWindow.xaml
index 9937fb3..aad3b1e 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Windowless Sample/MainWindow.xaml
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Windowless Sample/MainWindow.xaml
@@ -1,8 +1,8 @@
-
-
-
-
-
+
+
+
+
+
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Windowless Sample/MainWindow.xaml.cs b/Hardcodet.NotifyIcon.Wpf/Source/Windowless Sample/MainWindow.xaml.cs
index fe76599..f934e1d 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Windowless Sample/MainWindow.xaml.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Windowless Sample/MainWindow.xaml.cs
@@ -1,28 +1,28 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
-using System.Windows.Shapes;
-
-namespace Windowless_Sample
-{
- ///
- /// Interaction logic for MainWindow.xaml
- ///
- public partial class MainWindow : Window
- {
- public MainWindow()
- {
- InitializeComponent();
- }
- }
-}
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace Windowless_Sample
+{
+ ///
+ /// Interaction logic for MainWindow.xaml
+ ///
+ public partial class MainWindow : Window
+ {
+ public MainWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Windowless Sample/NotifyIconResources.xaml b/Hardcodet.NotifyIcon.Wpf/Source/Windowless Sample/NotifyIconResources.xaml
index 66ea812..aa4c02d 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Windowless Sample/NotifyIconResources.xaml
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Windowless Sample/NotifyIconResources.xaml
@@ -1,32 +1,32 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Windowless Sample/NotifyIconViewModel.cs b/Hardcodet.NotifyIcon.Wpf/Source/Windowless Sample/NotifyIconViewModel.cs
index a7e8fc3..9a9790f 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Windowless Sample/NotifyIconViewModel.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Windowless Sample/NotifyIconViewModel.cs
@@ -1,86 +1,86 @@
-using System;
-using System.Windows;
-using System.Windows.Input;
-
-namespace Windowless_Sample
-{
- ///
- /// Provides bindable properties and commands for the NotifyIcon. In this sample, the
- /// view model is assigned to the NotifyIcon in XAML. Alternatively, the startup routing
- /// in App.xaml.cs could have created this view model, and assigned it to the NotifyIcon.
- ///
- public class NotifyIconViewModel
- {
- ///
- /// Shows a window, if none is already open.
- ///
- public ICommand ShowWindowCommand
- {
- get
- {
- return new DelegateCommand
- {
- CanExecuteFunc = () => Application.Current.MainWindow == null,
- CommandAction = () =>
- {
- Application.Current.MainWindow = new MainWindow();
- Application.Current.MainWindow.Show();
- }
- };
- }
- }
-
- ///
- /// Hides the main window. This command is only enabled if a window is open.
- ///
- public ICommand HideWindowCommand
- {
- get
- {
- return new DelegateCommand
- {
- CommandAction = () => Application.Current.MainWindow.Close(),
- CanExecuteFunc = () => Application.Current.MainWindow != null
- };
- }
- }
-
-
- ///
- /// Shuts down the application.
- ///
- public ICommand ExitApplicationCommand
- {
- get
- {
- return new DelegateCommand {CommandAction = () => Application.Current.Shutdown()};
- }
- }
- }
-
-
- ///
- /// Simplistic delegate command for the demo.
- ///
- public class DelegateCommand : ICommand
- {
- public Action CommandAction { get; set; }
- public Func CanExecuteFunc { get; set; }
-
- public void Execute(object parameter)
- {
- CommandAction();
- }
-
- public bool CanExecute(object parameter)
- {
- return CanExecuteFunc == null || CanExecuteFunc();
- }
-
- public event EventHandler CanExecuteChanged
- {
- add { CommandManager.RequerySuggested += value; }
- remove { CommandManager.RequerySuggested -= value; }
- }
- }
-}
+using System;
+using System.Windows;
+using System.Windows.Input;
+
+namespace Windowless_Sample
+{
+ ///
+ /// Provides bindable properties and commands for the NotifyIcon. In this sample, the
+ /// view model is assigned to the NotifyIcon in XAML. Alternatively, the startup routing
+ /// in App.xaml.cs could have created this view model, and assigned it to the NotifyIcon.
+ ///
+ public class NotifyIconViewModel
+ {
+ ///
+ /// Shows a window, if none is already open.
+ ///
+ public ICommand ShowWindowCommand
+ {
+ get
+ {
+ return new DelegateCommand
+ {
+ CanExecuteFunc = () => Application.Current.MainWindow == null,
+ CommandAction = () =>
+ {
+ Application.Current.MainWindow = new MainWindow();
+ Application.Current.MainWindow.Show();
+ }
+ };
+ }
+ }
+
+ ///
+ /// Hides the main window. This command is only enabled if a window is open.
+ ///
+ public ICommand HideWindowCommand
+ {
+ get
+ {
+ return new DelegateCommand
+ {
+ CommandAction = () => Application.Current.MainWindow.Close(),
+ CanExecuteFunc = () => Application.Current.MainWindow != null
+ };
+ }
+ }
+
+
+ ///
+ /// Shuts down the application.
+ ///
+ public ICommand ExitApplicationCommand
+ {
+ get
+ {
+ return new DelegateCommand {CommandAction = () => Application.Current.Shutdown()};
+ }
+ }
+ }
+
+
+ ///
+ /// Simplistic delegate command for the demo.
+ ///
+ public class DelegateCommand : ICommand
+ {
+ public Action CommandAction { get; set; }
+ public Func CanExecuteFunc { get; set; }
+
+ public void Execute(object parameter)
+ {
+ CommandAction();
+ }
+
+ public bool CanExecute(object parameter)
+ {
+ return CanExecuteFunc == null || CanExecuteFunc();
+ }
+
+ public event EventHandler CanExecuteChanged
+ {
+ add { CommandManager.RequerySuggested += value; }
+ remove { CommandManager.RequerySuggested -= value; }
+ }
+ }
+}
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Windowless Sample/Properties/AssemblyInfo.cs b/Hardcodet.NotifyIcon.Wpf/Source/Windowless Sample/Properties/AssemblyInfo.cs
index ee1de76..fcf6826 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Windowless Sample/Properties/AssemblyInfo.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Windowless Sample/Properties/AssemblyInfo.cs
@@ -1,55 +1,55 @@
-using System.Reflection;
-using System.Resources;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Windows;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("Windowless Sample")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Windowless Sample")]
-[assembly: AssemblyCopyright("Copyright © 2013")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-//In order to begin building localizable applications, set
-//CultureYouAreCodingWith in your .csproj file
-//inside a . For example, if you are using US english
-//in your source files, set the to en-US. Then uncomment
-//the NeutralResourceLanguage attribute below. Update the "en-US" in
-//the line below to match the UICulture setting in the project file.
-
-//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
-
-
-[assembly: ThemeInfo(
- ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
- //(used if a resource is not found in the page,
- // or application resource dictionaries)
- ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
- //(used if a resource is not found in the page,
- // app, or any theme specific resource dictionaries)
-)]
-
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+using System.Reflection;
+using System.Resources;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Windows;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Windowless Sample")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Windowless Sample")]
+[assembly: AssemblyCopyright("Copyright © 2013")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+//In order to begin building localizable applications, set
+//CultureYouAreCodingWith in your .csproj file
+//inside a . For example, if you are using US english
+//in your source files, set the to en-US. Then uncomment
+//the NeutralResourceLanguage attribute below. Update the "en-US" in
+//the line below to match the UICulture setting in the project file.
+
+//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
+
+
+[assembly: ThemeInfo(
+ ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
+ //(used if a resource is not found in the page,
+ // or application resource dictionaries)
+ ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
+ //(used if a resource is not found in the page,
+ // app, or any theme specific resource dictionaries)
+)]
+
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/Windowless Sample/Windowless Sample.csproj b/Hardcodet.NotifyIcon.Wpf/Source/Windowless Sample/Windowless Sample.csproj
index f8f266e..06b72ef 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/Windowless Sample/Windowless Sample.csproj
+++ b/Hardcodet.NotifyIcon.Wpf/Source/Windowless Sample/Windowless Sample.csproj
@@ -1,98 +1,98 @@
-
-
-
-
- Debug
- AnyCPU
- {964EBFBE-A600-49B2-BDD8-422B46F1D544}
- WinExe
- Properties
- Windowless_Sample
- Windowless Sample
- v4.0
- 512
- {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- 4
-
-
-
- AnyCPU
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- AnyCPU
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
-
-
-
-
-
-
-
-
- 4.0
-
-
-
-
-
-
-
- MSBuild:Compile
- Designer
-
-
- MSBuild:Compile
- Designer
-
-
- App.xaml
- Code
-
-
- MainWindow.xaml
- Code
-
-
- Designer
- MSBuild:Compile
-
-
-
-
-
- Code
-
-
-
-
-
- {7AC63864-7638-41C4-969C-D3197EF2BED9}
- NotifyIconWpf
-
-
-
-
-
-
-
+
+
+
+
+ Debug
+ AnyCPU
+ {964EBFBE-A600-49B2-BDD8-422B46F1D544}
+ WinExe
+ Properties
+ Windowless_Sample
+ Windowless Sample
+ v4.0
+ 512
+ {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ 4
+
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+ 4.0
+
+
+
+
+
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ App.xaml
+ Code
+
+
+ MainWindow.xaml
+ Code
+
+
+ Designer
+ MSBuild:Compile
+
+
+
+
+
+ Code
+
+
+
+
+
+ {7AC63864-7638-41C4-969C-D3197EF2BED9}
+ NotifyIconWpf
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/WindowsFormsSample/FancyPopup.xaml b/Hardcodet.NotifyIcon.Wpf/Source/WindowsFormsSample/FancyPopup.xaml
index 1a023a2..a9d4893 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/WindowsFormsSample/FancyPopup.xaml
+++ b/Hardcodet.NotifyIcon.Wpf/Source/WindowsFormsSample/FancyPopup.xaml
@@ -1,129 +1,129 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/WindowsFormsSample/FancyPopup.xaml.cs b/Hardcodet.NotifyIcon.Wpf/Source/WindowsFormsSample/FancyPopup.xaml.cs
index 6799925..2a8fcaa 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/WindowsFormsSample/FancyPopup.xaml.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/WindowsFormsSample/FancyPopup.xaml.cs
@@ -1,45 +1,45 @@
-using System.Windows;
-
-namespace Samples
-{
- ///
- /// Interaction logic for FancyPopup.xaml
- ///
- public partial class FancyPopup
- {
- #region ClickCount dependency property
-
- ///
- /// The number of clicks on the popup button.
- ///
- public static readonly DependencyProperty ClickCountProperty =
- DependencyProperty.Register("ClickCount",
- typeof (int),
- typeof (FancyPopup),
- new FrameworkPropertyMetadata(0));
-
- ///
- /// A property wrapper for the
- /// dependency property:
- /// The number of clicks on the popup button.
- ///
- public int ClickCount
- {
- get { return (int) GetValue(ClickCountProperty); }
- set { SetValue(ClickCountProperty, value); }
- }
-
- #endregion
-
- public FancyPopup()
- {
- InitializeComponent();
- }
-
- private void OnButtonClick(object sender, RoutedEventArgs e)
- {
- //just increment a counter - will be displayed on screen
- ClickCount++;
- }
- }
+using System.Windows;
+
+namespace Samples
+{
+ ///
+ /// Interaction logic for FancyPopup.xaml
+ ///
+ public partial class FancyPopup
+ {
+ #region ClickCount dependency property
+
+ ///
+ /// The number of clicks on the popup button.
+ ///
+ public static readonly DependencyProperty ClickCountProperty =
+ DependencyProperty.Register("ClickCount",
+ typeof (int),
+ typeof (FancyPopup),
+ new FrameworkPropertyMetadata(0));
+
+ ///
+ /// A property wrapper for the
+ /// dependency property:
+ /// The number of clicks on the popup button.
+ ///
+ public int ClickCount
+ {
+ get { return (int) GetValue(ClickCountProperty); }
+ set { SetValue(ClickCountProperty, value); }
+ }
+
+ #endregion
+
+ public FancyPopup()
+ {
+ InitializeComponent();
+ }
+
+ private void OnButtonClick(object sender, RoutedEventArgs e)
+ {
+ //just increment a counter - will be displayed on screen
+ ClickCount++;
+ }
+ }
}
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/WindowsFormsSample/Form1.Designer.cs b/Hardcodet.NotifyIcon.Wpf/Source/WindowsFormsSample/Form1.Designer.cs
index eaab61d..8eed7cb 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/WindowsFormsSample/Form1.Designer.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/WindowsFormsSample/Form1.Designer.cs
@@ -1,62 +1,62 @@
-namespace WindowsFormsSample
-{
- partial class Form1
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.label1 = new System.Windows.Forms.Label();
- this.SuspendLayout();
- //
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(32, 25);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(408, 13);
- this.label1.TabIndex = 0;
- this.label1.Text = "Click on the red LED icon in the taskbar to display an interactive WPF Popup cont" +
- "rol.";
- //
- // Form1
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(488, 264);
- this.Controls.Add(this.label1);
- this.Name = "Form1";
- this.Text = "Form1";
- this.ResumeLayout(false);
- this.PerformLayout();
-
- }
-
- #endregion
-
- private System.Windows.Forms.Label label1;
- }
-}
-
+namespace WindowsFormsSample
+{
+ partial class Form1
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.label1 = new System.Windows.Forms.Label();
+ this.SuspendLayout();
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(32, 25);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(408, 13);
+ this.label1.TabIndex = 0;
+ this.label1.Text = "Click on the red LED icon in the taskbar to display an interactive WPF Popup cont" +
+ "rol.";
+ //
+ // Form1
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(488, 264);
+ this.Controls.Add(this.label1);
+ this.Name = "Form1";
+ this.Text = "Form1";
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Label label1;
+ }
+}
+
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/WindowsFormsSample/Form1.cs b/Hardcodet.NotifyIcon.Wpf/Source/WindowsFormsSample/Form1.cs
index 52da957..9e32170 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/WindowsFormsSample/Form1.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/WindowsFormsSample/Form1.cs
@@ -1,39 +1,39 @@
-using System;
-using System.Windows;
-using System.Windows.Forms;
-using Hardcodet.Wpf.TaskbarNotification;
-using Samples;
-using WindowsFormsSample.Properties;
-
-namespace WindowsFormsSample
-{
- public partial class Form1 : Form
- {
- private TaskbarIcon notifyIcon;
-
- public Form1()
- {
- InitializeComponent();
- }
-
- protected override void OnLoad(EventArgs e)
- {
- base.OnLoad(e);
- notifyIcon = new TaskbarIcon();
- notifyIcon.Icon = Resources.Led;
- notifyIcon.ToolTipText = "Left-click to open popup";
- notifyIcon.Visibility = Visibility.Visible;
-
- notifyIcon.TrayPopup = new FancyPopup();
- }
-
- protected override void OnClosed(EventArgs e)
- {
- base.OnClosed(e);
-
- //the notify icon only closes automatically on WPF applications
- //-> dispose the notify icon manually
- notifyIcon.Dispose();
- }
- }
+using System;
+using System.Windows;
+using System.Windows.Forms;
+using Hardcodet.Wpf.TaskbarNotification;
+using Samples;
+using WindowsFormsSample.Properties;
+
+namespace WindowsFormsSample
+{
+ public partial class Form1 : Form
+ {
+ private TaskbarIcon notifyIcon;
+
+ public Form1()
+ {
+ InitializeComponent();
+ }
+
+ protected override void OnLoad(EventArgs e)
+ {
+ base.OnLoad(e);
+ notifyIcon = new TaskbarIcon();
+ notifyIcon.Icon = Resources.Led;
+ notifyIcon.ToolTipText = "Left-click to open popup";
+ notifyIcon.Visibility = Visibility.Visible;
+
+ notifyIcon.TrayPopup = new FancyPopup();
+ }
+
+ protected override void OnClosed(EventArgs e)
+ {
+ base.OnClosed(e);
+
+ //the notify icon only closes automatically on WPF applications
+ //-> dispose the notify icon manually
+ notifyIcon.Dispose();
+ }
+ }
}
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/WindowsFormsSample/Form1.resx b/Hardcodet.NotifyIcon.Wpf/Source/WindowsFormsSample/Form1.resx
index ff31a6d..19dc0dd 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/WindowsFormsSample/Form1.resx
+++ b/Hardcodet.NotifyIcon.Wpf/Source/WindowsFormsSample/Form1.resx
@@ -1,120 +1,120 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/WindowsFormsSample/Program.cs b/Hardcodet.NotifyIcon.Wpf/Source/WindowsFormsSample/Program.cs
index b155e0a..026aaa3 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/WindowsFormsSample/Program.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/WindowsFormsSample/Program.cs
@@ -1,20 +1,20 @@
-using System;
-using System.Windows.Forms;
-using Samples;
-
-namespace WindowsFormsSample
-{
- internal static class Program
- {
- ///
- /// The main entry point for the application.
- ///
- [STAThread]
- private static void Main()
- {
- Application.EnableVisualStyles();
- Application.SetCompatibleTextRenderingDefault(false);
- Application.Run(new Form1());
- }
- }
+using System;
+using System.Windows.Forms;
+using Samples;
+
+namespace WindowsFormsSample
+{
+ internal static class Program
+ {
+ ///
+ /// The main entry point for the application.
+ ///
+ [STAThread]
+ private static void Main()
+ {
+ Application.EnableVisualStyles();
+ Application.SetCompatibleTextRenderingDefault(false);
+ Application.Run(new Form1());
+ }
+ }
}
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/WindowsFormsSample/Properties/AssemblyInfo.cs b/Hardcodet.NotifyIcon.Wpf/Source/WindowsFormsSample/Properties/AssemblyInfo.cs
index 3ba7613..b6341d8 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/WindowsFormsSample/Properties/AssemblyInfo.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/WindowsFormsSample/Properties/AssemblyInfo.cs
@@ -1,40 +1,40 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-
-[assembly: AssemblyTitle("WindowsFormsSample")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Microsoft")]
-[assembly: AssemblyProduct("WindowsFormsSample")]
-[assembly: AssemblyCopyright("Copyright © Microsoft 2009")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-
-[assembly: Guid("072bbfa0-9b8b-48df-bf88-3e4806b3e3e8")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-
-[assembly: AssemblyVersion("1.0.0.0")]
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+
+[assembly: AssemblyTitle("WindowsFormsSample")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("WindowsFormsSample")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2009")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+
+[assembly: Guid("072bbfa0-9b8b-48df-bf88-3e4806b3e3e8")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+
+[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/WindowsFormsSample/Properties/Resources.Designer.cs b/Hardcodet.NotifyIcon.Wpf/Source/WindowsFormsSample/Properties/Resources.Designer.cs
index 4dc5ac7..ad67f05 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/WindowsFormsSample/Properties/Resources.Designer.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/WindowsFormsSample/Properties/Resources.Designer.cs
@@ -1,73 +1,73 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.18408
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace WindowsFormsSample.Properties {
- using System;
-
-
- ///
- /// A strongly-typed resource class, for looking up localized strings, etc.
- ///
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Resources {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Resources() {
- }
-
- ///
- /// Returns the cached ResourceManager instance used by this class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
- get {
- if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WindowsFormsSample.Properties.Resources", typeof(Resources).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- ///
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
- get {
- return resourceCulture;
- }
- set {
- resourceCulture = value;
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
- ///
- internal static System.Drawing.Icon Led {
- get {
- object obj = ResourceManager.GetObject("Led", resourceCulture);
- return ((System.Drawing.Icon)(obj));
- }
- }
- }
-}
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.18408
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace WindowsFormsSample.Properties {
+ using System;
+
+
+ ///
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ ///
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ ///
+ /// Returns the cached ResourceManager instance used by this class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WindowsFormsSample.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+
+ ///
+ /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
+ ///
+ internal static System.Drawing.Icon Led {
+ get {
+ object obj = ResourceManager.GetObject("Led", resourceCulture);
+ return ((System.Drawing.Icon)(obj));
+ }
+ }
+ }
+}
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/WindowsFormsSample/Properties/Resources.resx b/Hardcodet.NotifyIcon.Wpf/Source/WindowsFormsSample/Properties/Resources.resx
index 4c8eec3..d657fca 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/WindowsFormsSample/Properties/Resources.resx
+++ b/Hardcodet.NotifyIcon.Wpf/Source/WindowsFormsSample/Properties/Resources.resx
@@ -1,124 +1,124 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
-
- ..\icon\led.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+
+ ..\icon\led.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/WindowsFormsSample/Properties/Settings.Designer.cs b/Hardcodet.NotifyIcon.Wpf/Source/WindowsFormsSample/Properties/Settings.Designer.cs
index 2a00ed0..b781a34 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/WindowsFormsSample/Properties/Settings.Designer.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/WindowsFormsSample/Properties/Settings.Designer.cs
@@ -1,26 +1,26 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.18408
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace WindowsFormsSample.Properties {
-
-
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
- internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
-
- private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
-
- public static Settings Default {
- get {
- return defaultInstance;
- }
- }
- }
-}
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.18408
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace WindowsFormsSample.Properties {
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default {
+ get {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/WindowsFormsSample/Properties/Settings.settings b/Hardcodet.NotifyIcon.Wpf/Source/WindowsFormsSample/Properties/Settings.settings
index eeb7df0..e04fc63 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/WindowsFormsSample/Properties/Settings.settings
+++ b/Hardcodet.NotifyIcon.Wpf/Source/WindowsFormsSample/Properties/Settings.settings
@@ -1,8 +1,8 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/WindowsFormsSample/WindowsFormsSample.csproj b/Hardcodet.NotifyIcon.Wpf/Source/WindowsFormsSample/WindowsFormsSample.csproj
index 6ee8d4e..d7823aa 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/WindowsFormsSample/WindowsFormsSample.csproj
+++ b/Hardcodet.NotifyIcon.Wpf/Source/WindowsFormsSample/WindowsFormsSample.csproj
@@ -1,162 +1,162 @@
-
-
-
- Debug
- AnyCPU
- 9.0.30729
- 2.0
- {F6DC0A6D-D1CE-4AD2-92ED-08FFF0AD4FA8}
- WinExe
- Properties
- WindowsFormsSample
- WindowsFormsSample
- v4.0
- 512
- WindowsFormsSample.Program
-
-
- 3.5
-
- publish\
- true
- Disk
- false
- Foreground
- 7
- Days
- false
- false
- true
- 0
- 1.0.0.%2a
- false
- false
- true
- Client
-
-
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
- AllRules.ruleset
-
-
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
- AllRules.ruleset
-
-
-
-
-
-
- 3.5
-
-
-
- 3.5
-
-
- 3.5
-
-
-
-
-
-
-
- 3.0
-
-
- 3.0
-
-
-
-
- FancyPopup.xaml
-
-
- Form
-
-
- Form1.cs
-
-
-
-
- Form1.cs
-
-
- ResXFileCodeGenerator
- Resources.Designer.cs
- Designer
-
-
- True
- Resources.resx
- True
-
-
- SettingsSingleFileGenerator
- Settings.Designer.cs
-
-
- True
- Settings.settings
- True
-
-
-
-
- MSBuild:Compile
- Designer
- MSBuild:Compile
- Designer
-
-
-
-
-
-
-
- {7AC63864-7638-41C4-969C-D3197EF2BED9}
- NotifyIconWpf
-
-
-
-
-
-
-
- False
- .NET Framework 3.5 SP1 Client Profile
- false
-
-
- False
- .NET Framework 3.5 SP1
- true
-
-
- False
- Windows Installer 3.1
- true
-
-
-
-
+
+
+
+ Debug
+ AnyCPU
+ 9.0.30729
+ 2.0
+ {F6DC0A6D-D1CE-4AD2-92ED-08FFF0AD4FA8}
+ WinExe
+ Properties
+ WindowsFormsSample
+ WindowsFormsSample
+ v4.0
+ 512
+ WindowsFormsSample.Program
+
+
+ 3.5
+
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
+ Client
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+ AllRules.ruleset
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+ AllRules.ruleset
+
+
+
+
+
+
+ 3.5
+
+
+
+ 3.5
+
+
+ 3.5
+
+
+
+
+
+
+
+ 3.0
+
+
+ 3.0
+
+
+
+
+ FancyPopup.xaml
+
+
+ Form
+
+
+ Form1.cs
+
+
+
+
+ Form1.cs
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+ Designer
+
+
+ True
+ Resources.resx
+ True
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+ True
+ Settings.settings
+ True
+
+
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+
+
+
+
+
+ {7AC63864-7638-41C4-969C-D3197EF2BED9}
+ NotifyIconWpf
+
+
+
+
+
+
+
+ False
+ .NET Framework 3.5 SP1 Client Profile
+ false
+
+
+ False
+ .NET Framework 3.5 SP1
+ true
+
+
+ False
+ Windows Installer 3.1
+ true
+
+
+
+
\ No newline at end of file