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?