且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

[UWP]视图和窗口有什么区别?为什么我们还有带窗口和View的调度程序?

更新时间:2023-11-03 16:02:40

您好,

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

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