コード例 #1
0
        protected override async void OnStartup(StartupEventArgs e)
        {
            // Register with notification platform
            await DesktopNotificationManagerCompat.RegisterWithPlatformAsync <MyNotificationActivator>(
                aumid : "Microsoft.WpfDesktopToasts7",
                displayName : "WPF Desktop Toasts 7",
                logo : "C:\\logo.png",
                logoBackgroundColor : "transparent");

            // And then register COM server and activator type
            DesktopNotificationManagerCompat.RegisterComServerAndActivator <MyNotificationActivator>();

            // If launched from a toast
            if (e.Args.Contains("-ToastActivated"))
            {
                // Our NotificationActivator will handle showing windows if necessary
                base.OnStartup(e);
                return;
            }

            // Show the window
            new MainWindow().Show();

            base.OnStartup(e);
        }