Firing an event in the foreground when a background job is running at the same time?

I have a background task in a separate project (dll) for a windows store application.

My background task starts when I receive a push notification. Most of the time this happens when the application is not in use. The notification is saved, and when the application loads again, the action starts based on the received one. This is easy to implement using LocalSettings, the application can verify that something is stored there at boot time.

However, when the application is in the foreground, I want to call something in the application itself. Without constantly looking at LocalSettings, is there a mechanism that I can use to associate a task with the main application to call something?

+4
source share
1 answer

Without a more specific question, it is difficult to offer concrete advice.

However, on WinRT, I believe that your best option is to use sockets to communicate between the background and front processes. A named pipe will be preferable, but this is not supported on WinRT.

Another option that is supported in WinRT is a named mutex. But it cannot transmit data; it can only be used to supply a signal from one process to another, and there is no built-in asynchronous mutex wait mechanism, while sockets can be used asynchronously.

, IMHO , , .

WinRT , . , , , , WinRT . . - , Metro Style? . , , , . .

WNS: (Windows Runtime apps). , " " . , -, UI (, ), "" API : Windows.Networking.PushNotifications

+1

Source: https://habr.com/ru/post/1570054/


All Articles