[UWP]视图和窗口有什么区别?为什么我们还有带窗口和View的调度程序? [英] [UWP] What's difference between view and window? Why do we have dispatcher with window and View as well?

查看:159
本文介绍了[UWP]视图和窗口有什么区别?为什么我们还有带窗口和View的调度程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经看到CoreApplication对象是一个对象CoreApplicationView,它可以是Main和一个CoreApplicationViews队列。这究竟是什么"主要" CoreApplicationView? 

I have seen CoreApplication object an object CoreApplicationView which can be Main and one queue of CoreApplicationViews as well. What exactly is this "Main" CoreApplicationView? 

其次,有一个CoreWindow与一个CoreApplication关联,这意味着在每个应用程序视图中附加一个窗口。在View中,我们有一个dispacter但是在Window对象中我们有一个调度程序?我在这里有点困惑。 

Secondly, there is one CoreWindow associated with one CoreApplication, this mean in every app view one window is attached. In View, we have a dispacter but in Window object as well we have a dispatcher? I am little confused here. 

为什么需要提供一小段代码才需要这两位调度员? 

Why are those 2 dispatchers needed by giving some small snippet of code? 

非常感谢提前。

推荐答案

您好,

请先查看有关申请窗口的官方文档:

Please check the official doc about Application Window first:

https://docs.microsoft.com/en-us/uwp/api/Windows.UI.ViewManagement.ApplicationView

https://docs.microsoft.com/en-us/uwp/api/Windows.UI.ViewManagement.ApplicationView

"一个窗口(也称为应用程序视图)是Windows运行时应用程序的显示部分。在Windows上,用户的屏幕最多可同时显示4个可变宽度的窗口。它们不重叠,它们的顶部和底部边缘触及屏幕顶部的
和底部边缘。相邻窗口之间可能存在非窗口区域。

窗口与应用程序的当前页面不同。最好将其视为页面的容器;您可以在程序中使用窗口引用来处理应用程序的所有页面。

每个窗口都有一个对应的CoreWindow,它代表窗口的UI处理线程(包括核心输入处理程序和事件调度程序) 。$
您可以在配置页面时使用窗口的属性(或JavaScript方法)。例如:Orientation属性告诉您窗口是纵向还是横向;对于Windows,AdjacentToLeftDisplayEdge属性告诉您屏幕左边缘的
是否是窗口的左边框; isFullScreen方法告诉您窗口是否使用整个屏幕。有关使用这些方法的示例,请参阅"应用程序视图"示例。"

"A window (also called an app view) is the displayed portion of a Windows Runtime app. On Windows, a user's screen can have up to 4 windows of variable width displayed simultaneously. They do not overlap, and their top and bottom edges touch the top and bottom edges of the screen. There may be non-window areas between adjacent windows.
The window is not the same thing as the current page of the application. It is better thought of as the container of the pages; you can use the window reference in your program for all the pages of the application.
Each window has a corresponding CoreWindow that represents the UI processing thread (including the core input handlers and event dispatcher) for the window.
You can use the properties (or methods, for JavaScript) of the window in configuring your pages. For example: the Orientation property tells you whether the window is portrait or landscape; for Windows the AdjacentToLeftDisplayEdge property tells you whether the left edge of the screen is the left border of the window; and the isFullScreen method tells you whether the window uses the entire screen. For examples of using these methods, see the Application Views sample."

因此,ApplicationView是页面的容器,它实际上是托管页面的窗口。我相信上面的文档已经清楚它是什么了。

So ApplicationView is the container of the pages and it is actually the window which will host your pages. I believe the doc above has already be clear about what is it.

对于你的第二个问题,你在这里是什么意思?  ApplicationView还会调用CoreWindow来拥有一个调度程序。如果你的意思是CoreApplicationView也有调度员,你有没有检查官方

doc
:表示应用程序窗口及其主题。它还包含主题。

For your second question, what do you mean here?  ApplicationView will also call CoreWindow to have a dispatcher. If you mean CoreApplicationView also has the dispatcher, have you checked the official doc:Represents an app window and its thread. It also contains the thread.

祝你好运,

Barry


这篇关于[UWP]视图和窗口有什么区别?为什么我们还有带窗口和View的调度程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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