You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I followed the instructions here to enable Toast support in my multi-instance application.
When each instance of my app gets launched, it uses AppNotificationManager to register for Toast notification events:
AppNotificationManager.Default.NotificationInvoked+=AppNotificationManager_NotificationInvoked;AppNotificationManager.Default.Register();voidAppNotificationManager_NotificationInvoked(objectsender,AppNotificationActivatedEventArgsargs){// Does nothing yet.}
Each instance of my application launches MainWindow which has one button that generates a toast when clicked.
When I press the button on the first instance (ProcessID=1) of my app and then click on the generated Toast, the AppNotificationManager_NotificationInvoked handler gets called as expected.
If I launch a second instance of my app (ProcessID=2) and do the same thing, AppNotificationManager_NotificationInvoked gets called again, but instead of being called for the second instance of my application, it gets called for the first instance (PID=1).
It seems that no matter how many independent instances of my application get launched and register for toast notifications, only the first instance ever receives the notifications.
I took a look at this article on App Lifecycle Instancing, hoping that it may provide a way to send a NotificationInvoked event from one instance to another, but since the Toast notifications don't come in through AppInstance.GetCurrent().Activated, I can't see a way to do it.
Am I missing something here. Windows App SDK applications are mult-instance by default. And to that point, what I want is for each instance of my application to independently manage activation of toasts that it generates. How can I accomplish this?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I followed the instructions here to enable Toast support in my multi-instance application.
When each instance of my app gets launched, it uses
AppNotificationManager
to register for Toast notification events:Each instance of my application launches
MainWindow
which has one button that generates a toast when clicked.When I press the button on the first instance (
ProcessID=1
) of my app and then click on the generated Toast, theAppNotificationManager_NotificationInvoked
handler gets called as expected.If I launch a second instance of my app (
ProcessID=2
) and do the same thing,AppNotificationManager_NotificationInvoked
gets called again, but instead of being called for the second instance of my application, it gets called for the first instance (PID=1
).It seems that no matter how many independent instances of my application get launched and register for toast notifications, only the first instance ever receives the notifications.
I took a look at this article on App Lifecycle Instancing, hoping that it may provide a way to send a
NotificationInvoked
event from one instance to another, but since the Toast notifications don't come in throughAppInstance.GetCurrent().Activated
, I can't see a way to do it.Am I missing something here. Windows App SDK applications are mult-instance by default. And to that point, what I want is for each instance of my application to independently manage activation of toasts that it generates. How can I accomplish this?
Thanks in advance?
Beta Was this translation helpful? Give feedback.
All reactions