Skip to content

Instantly share code, notes, and snippets.

@andy51002000
Last active October 28, 2018 10:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andy51002000/25f4e3fd2ca66f4d9d6fece3c9b5f30b to your computer and use it in GitHub Desktop.
Save andy51002000/25f4e3fd2ca66f4d9d6fece3c9b5f30b to your computer and use it in GitHub Desktop.
Overrid OnBackgroundActivated to communicate with win32
protected async override void OnBackgroundActivated(BackgroundActivatedEventArgs args)
{
base.OnBackgroundActivated(args);
if (args.TaskInstance.TriggerDetails is AppServiceTriggerDetails)
{
appServiceDeferral = args.TaskInstance.GetDeferral();
args.TaskInstance.Canceled += OnTaskCanceled; // Associate a cancellation handler with the background task.
AppServiceTriggerDetails details = args.TaskInstance.TriggerDetails as AppServiceTriggerDetails;
Connection = details.AppServiceConnection;
// Send request to win32
await SendRequestToWin32();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment