0
votes

I'm working on a UWP app which has a background task and a UI.

The background task is a UWP VPN plugin. It's started when the user goes into Settings/VPN, chooses a profile and clicks on connect. At this time, Windows will start the whole app, but the UI will be hidden automatically, by Windows.

The user can then start the app, which results in Windows un-hiding the same process, showing the UI, and the user can see relevant data (this is used to show statistics etc).

The problem is, if the user then clicks on the close button, it will exit the whole process, complete with the background task.

I need a way to just put the app back into its original hidden state, as it was when it was indirectly started from Settings, and not to actually exit the process.

How can I do that in UWP?

1
In content app.xaml.cs dont set frame ?You can see the OnLaunched have set the content as frame,but it will show the From. - lindexi
How would that help? The user needs to be able to see the UI if he starts it. It's when he closes it, that I need to just hide it instead of exiting. - Dragan Juric
The UWP can run background,but dont know how to just hide it when he close it.And when it closed , Suspend will be run.I try to dim the task in Suspend and save the info,but useless. - lindexi

1 Answers

0
votes

This was a bug in the VPN UWP framework which was subsequently fixed in the Windows 10 Anniversary update.

Though the way the UWP VPN Framework was built, even if it closes and the process is killed, it will immediately be respawned and the connection should recover instantly.