Samples for Win32 desktop apps using toast notifications with COM activation.
This sample demonstrates how a desktop app can display a toast notification and respond to events generated by the user's interaction with the toast.
This sample is provided as-is in order to indicate or demonstrate the functionality of the programming models and feature APIs.
How to use the sample...
- Open the project in VS
- Set the
DesktopToastsPackageProject
as the startup project - Deploy
Toasts will work out-of-the-gate thanks to Desktop Bridge!
- Install WiX Toolset if you haven't yet
- Open the project in VS
- Build the SetupProject
- Install the generated MSI from the bin/Debug folder
- Launch the Desktop Toasts app from the Start menu
After you've installed with the MSI once, you can debug straight from Visual Studio. Installing via the MSI creates the Start menu shortcut with the AUMID and COM CLSID so your notifications can appear and be actionable.
If you don't install the MSI first, toasts will not appear.
Squirrel derives the AUMID (AppUserModelID) by building a string of schema com.squirrel.<package id>.<executable name>
.
This needs to be set to the process at runtime/when registering the COM server/activator.
The COM CLSID is derived from the AUMID via https://tools.ietf.org/html/rfc4122#section-4.3 which does not seem to be implemented in the base class library of .NET.
As a workaround App.OnStartup
contains the calls to invoke the squirrel-internal implementation.
- Build the solution in
Release
configuration - In the package manager console run
nuget pack .\SquirrelSetup\DesktopToastsApp.nuspec
- In the package manager console run
Squirrel --releasify .\DesktopToastsApp.1.0.0.nupkg
- Install
Releases\Setup.exe