当另一个 AppWindow 在第二台显示器上进入全屏时,如何保持 UWP AppWindow 全屏? [英] How keep a UWP AppWindow fullscreen when another AppWindow enters Fullscreen on 2nd monitor?

查看:31
本文介绍了当另一个 AppWindow 在第二台显示器上进入全屏时,如何保持 UWP AppWindow 全屏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在单独的显示器上全屏打开 2 个 AppWindows (appWindowOne & appWindowTwo),但是当 appWindowTwo 打开 appWindowOne 最小化.我尝试以编程方式让 AppWindow 重新进入全屏,但它会导致另一个 AppWindow 最小化.在任务栏中手动单击时,它会恢复到全屏,而不会影响其他屏幕,但我想知道是否可以通过编程方式进行操作?

I'm trying to open 2 AppWindows (appWindowOne & appWindowTwo) on separate monitors in full screen but when appWindowTwo opens appWindowOne minimizes. I've tried making the AppWindow re-enter full screen programmatically but it causes the other AppWindow to minimize. When manually clicked in the taskbar it restores to full screen without affecting the other but I would like to know if it's possible to do it programmatically?

public static async void ShowAppWindows()
{
    AppWindow appWindowOne = await AppWindow.TryCreateAsync();
    Frame frameOne = new Frame();
    ElementCompositionPreview.SetAppWindowContent(appWindowOne, frameOne);

    AppWindow appWindowTwo = await AppWindow.TryCreateAsync();
    Frame frameTwo = new Frame();
    ElementCompositionPreview.SetAppWindowContent(appWindowTwo, frameTwo);

    FullScreenPresentationConfiguration FSPC = new FullScreenPresentationConfiguration()
    {
         IsExclusive = false
    };

    await appWindowOne.TryShowAsync();
    appWindowOne.RequestMoveToDisplayRegion(displayRegions[0]);
    appWindowOne.Presenter.RequestPresentation(FSPC);

    await appWindowTwo.TryShowAsync();
    appWindowTwo.RequestMoveToDisplayRegion(displayRegions[1]);
    appWindowTwo.Presenter.RequestPresentation(FSPC);
}

推荐答案

.我尝试以编程方式让 AppWindow 重新进入全屏,但它会导致另一个 AppWindow 最小化.

. I've tried making the AppWindow re-enter full screen programmatically but it causes the other AppWindow to minimize.

appWindowTwo 进入全屏时,这看起来 UI 线程被破坏了.我想在全屏模式下连续设置两个窗口会耗尽 UI 线程.因此,我们可以尝试在使 appWindowTwo 全屏之前调用 Task.Delay().

This looks UI-thread was broken when make appWindowTwo into full screen. I guess setting two windows in a row in full screen will exhaust the UI thread. So, we could try to call a Task.Delay() before making appWindowTwo into full screen.

这篇关于当另一个 AppWindow 在第二台显示器上进入全屏时,如何保持 UWP AppWindow 全屏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆