简体   繁体   中英

How can I launch another app in full screen using LaunchUriForResultAsync?

I would like to use the LaunchUriForResultAsync to launch my other app and get some results from it. But I want to launch the other app in full screen and if that's not possible maybe just launch it in a bigger size.

When I launch another app using LaunchUriForResultAsync, the modal app launches in 500x500 size. I would need something bigger than that because I need to create a data entry app that requires more space which multiple applications can launch. I tried to set the DesiredRemainingView and PreferredLaunchWindowingMode to FullScreen . It didn't make my other app launch in full screen.

Is there a way I can use LaunchUriForResultAsync to launch my other app in full screen?

It is not possible to control the size of the window launched for results. In current versions of Windows this size is hard coded to 500x500. Providing a way to allow an app to control this is being investigated for future a future update.

Since you control both apps you could write a custom system to manage the communication rather than use LaunchUriForResultAsync. AppA and AppB can each define their own protocols (appa: and appb:). AppA can LaunchUriAsync appb: to do whatever it needs, then AppB can LaunchUriAsync appa: to deliver the results. Pass AppA's return URL as an argument to appb: and this can be called from multiple apps.

The trickiest part may be to manage the modality. It's easy to disable AppA's page while it's waiting, but harder to link AppB's window to AppA's after the initial launch. Off the top of my head I'd just relaunch appb: and make sure appb: can track and handle multiple launches sanely.

This is more or less what LaunchUriForResultAsync does for you.

If the device is in Tablet Mode , you can use ViewSizePreference.SizeNone and the app will be launched in full screen:

var options = new Windows.System.LauncherOptions();
options.DesiredRemainingView = Windows.UI.ViewManagement.ViewSizePreference.UseNone;
await Windows.System.Launcher.LaunchUriAsync(uri, options);

I think part of the confusion here is that the size preference defines the space your current app desires, not the size you want for the launched app. Because the target app can have its own preferences.

This solution does not work if Tablet Mode is disabled, then you would have to go with a solution as Rob Caplan suggested.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM