[UWP]从不同的线程获取ApplicationView /从不同的线程切换到全屏; [英] [UWP] Get ApplicationView from different thread / switching to fullscreen from different thread;

查看:118
本文介绍了[UWP]从不同的线程获取ApplicationView /从不同的线程切换到全屏;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


你好,



有没有办法从主应用程序线程以外的地方访问ApllicationView?  ; $


Windows :: UI :: ViewManagement :: ApplicationView :: GetForCurrentView();总是导致"找不到元素"错误,即使在"alt-enter"时也是如此。在应用程序主线程中定义的全屏切换功能完美无缺。



Best,Radek

解决方案

CoreApplicationView提供的属性可以返回应用程序的MainView或返回所有应用程序视图的集合。


获得View后即可使用其Dispatcher属性来编组一个函数,以便在视图的调度程序线程上运行。


https://docs.microsoft.com/en-us/uwp/api/windows.applicationmodel.core.coreapplication#Windows_ApplicationModel_Core_CoreApplication_Views


https://docs.microsoft.com/en-us /uwp/api/windows.applicationmodel.core.coreapp licationview#Windows_ApplicationModel_Core_CoreApplicationView_Dispatcher


Hallo,

Is there any way to get to the ApllicationView from other than the main app thread? 

Windows::UI::ViewManagement::ApplicationView::GetForCurrentView(); always causes "element not found" error, even when the "alt-enter" fullscreen switch function defined in the main thread of the app works perfect.

Best, Radek

解决方案

The CoreApplicationView provides properties to return the app's MainView or to return a collection of all of the app's Views.

Once you have the View you can use its Dispatcher property to marshal a function to run on the view's dispatcher thread.

https://docs.microsoft.com/en-us/uwp/api/windows.applicationmodel.core.coreapplication#Windows_ApplicationModel_Core_CoreApplication_Views

https://docs.microsoft.com/en-us/uwp/api/windows.applicationmodel.core.coreapplicationview#Windows_ApplicationModel_Core_CoreApplicationView_Dispatcher


这篇关于[UWP]从不同的线程获取ApplicationView /从不同的线程切换到全屏;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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