仅在任务栏中显示的 WPF 窗口

发布于 2024-12-03 07:01:19 字数 352 浏览 0 评论 0原文

我不确定我想做的是否合适,所以我会解释一下。

我们有一个大型应用程序,需要一段时间才能加载。所以我们有一个闪屏。 启动屏幕会导致远程桌面(终端服务器)加载时间过长。 因此,为了缓解这种情况,我们希望在 RDP 上加载时隐藏启动屏幕。 但我们仍然需要至少向用户显示应用程序正在加载。

所以,我想也许只是在任务栏(而不是系统托盘)中显示一些内容,因为一旦应用程序完全加载,它就会消失(并被主窗体的任务图标替换)。 然而,我见过的任何 WPF 解决方案都需要一个可见的表单/窗口来配合任务栏状态。

有没有办法在任务栏中显示某些内容而不显示 WPF 窗口?

或者是否有另一种方法可以在屏幕上不显示任何内容的情况下显示应用程序加载状态?

I'm not sure if what I want to do is appropriate, so I'll explain a little.

We've got a large application that takes a while to load. So we have a splash screen.
The Splash screen causes excessive load time on Remote Desktop (terminal server).
So to alleviate this, we want to hide the splash screen when loading on RDP.
But we still need to at least show the user that the application is loading.

So, I was thinking perhaps just show something in the Taskbar (not the system tray), as it will disappear once the application is fully loaded (and be replaced by the main form's Task icon).
However any WPF solution I've looked at, requires a visible form/window to go with the Taskbar status.

Is there any way of showing something in the Taskbar without showing a WPF window?

Or is there another way of showing application load status without something on the screen?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

涫野音 2024-12-10 07:01:19

我们有同样的问题。

在远程桌面上,我们执行了以下步骤...

  1. 我们将启动窗口配置为不允许调整大小,并且只有最小化和关闭按钮。

  2. 我们删除了 WindowStyle=None 设置,以便出现 Splash 窗口的标题栏

  3. 我们将 Splash 窗口的宽度和高度设置为零。这样,您在屏幕上看到的只是标题栏的一个蓝色小矩形,其中包含文本“正在加载...请稍候...”以及最小化和关闭按钮。

  4. 我们也使用 Window 的内核调用来禁用标题栏的关闭按钮。这样用户就无法取消启动窗口。

  5. 因此,用户所能做的就是最小化或从任务栏恢复。

恢复后,他看到的只是标题栏的蓝色矩形,上面有“正在加载...”文本。这样,窗口也占据了任务栏上的位置,但隐藏了其启动动画,并且用户也知道启动屏幕正在加载。为此,您还可以通过附加更多句号来更新标题栏的文本...

正在加载。请稍候...

正在加载。请稍候...

正在加载。请稍等...

正在加载。请稍等..

We had same problem.

On remote desktop, we did following steps...

  1. We configured the Splash window to not allow resizing and have only Minimize and Close button.

  2. We removed WindowStyle=None setting so that title bar of the Splash window appeared

  3. We made the Splash window's width and height zero. This way all you see on screen is a small blue rectangle of the title bar with Text "Loading... Please Wait ..." and minimize and Close button.

  4. We used Window's kernel calls to disable title bar's Close button too. This way user was not able to cancel the Splash window.

  5. So all a user could do is to minimize or restore from taskbar.

When restored, all he sees is a title bar's blue rectangle with "Loading..." text. This way the window also claimed its place on the task bar but hid its splash animation and user is also aware that the splash screen is loading. For this you can also update the Title bar's text by appending more fullstops ...

Loading. Please Wait..

Loading. Please Wait...

Loading. Please Wait....

Loading. Please Wait..

混吃等死 2024-12-10 07:01:19

我确实认为您需要调查问题的根本原因。可能会考虑线程和并行性。

然而,对于您所要求的问题,一个简单的解决方案是创建一个隐藏窗口。一种透明的、没有边界或任何东西的。它甚至可以设置为 0, 0 的大小。这样您就可以获得您需要的任务栏项目。

I do think you need to look into the root cause of your issue. Possibly looking at threading and parallelism.

However, a simple solution to what you are asking would be to just create a hidden window. One that is transparent, no borders or anything. It could even bet set to a size of 0, 0. That way you would be able to get the taskbar item that you require.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文