Show MainPage.xaml from "VPN Client" UWP app

dovholuknf 1 Reputation point

UWP allows for the definition of "custom vpn plugins" by adding the "networkingVpnProvider" Capability. When one goes to "Network & Internet" -> "VPN" and clicks "connect" the application containing the background task will launch. If that application has a UI - one can also view the UI by starting the application from start -> "name of app".

That's all great - what I'd like to do since this is a VPN I'd like the UI to pop up when the user clicks the "Connect" button. I can't find the right API to pop up the "MainPage" associated with a background task. I also can't pass a pass a reference into the background task since it's windows itself that's starting it...

Hopefully this is doable. Thanks in advance for any help.

Universal Windows Platform (UWP)
{count} votes

2 answers

Sort by: Most helpful
  1. PeteR Smith 1 Reputation point

    You can have a certain amount of UI elements be displayed by using the various VpnCustom* items. For example, use VpnCustomPrompt to prompt the user for a value. You can't show arbitrary UI.

    As you probably already know, the vpnNetworkProvider capability is restricted; not all companies will get it.

  2. Roy Li - MSFT 32,721 Reputation points Microsoft Vendor


    Welcome to Microsoft Q&A!

    Yes, there is a way to bring the UWP app to the foreground. It's called CompactOverlay mode. But I don't think that is suitable for your scenario.
    If you just want to let the customer know that the app is connected and it's running correctly, you could try another way by sending a local toast notification to the user. Then if the user click the notification, it could launch your app.

    For more information about sending notifications, please refer to: Send a local toast notification

    Thank you

    0 comments No comments