显示等待光标?

发布于 2024-08-18 20:05:23 字数 583 浏览 1 评论 0原文

我想在我正在编写的 Prism 应用程序中的耗时过程中显示等待光标。我已使用 WaitCursorRequestEvent 复合事件将其连接起来。 'True' 表示显示等待光标,'false' 表示返回默认值。

Shell 订阅事件并使用以下事件处理程序处理它:

/// <summary>
/// Handles the WaitCursorRequest event.
/// </summary>
public void OnWaitCursorRequest(bool showWaitCursor)
{
    // Set cursor
    this.Cursor = showWaitCursor ? Cursors.Wait : Cursors.Arrow;
    this.ForceCursor = true;
}

执行耗时进程的模块在启动进程时使用“true”有效负载发布事件,并使用“false”有效负载再次发布事件当它完成该过程时。

事件处理程序在这两种情况下都被调用——我通过设置断点进行了测试。但光标没有改变。知道我做错了什么吗?谢谢。

I want to show a wait cursor during a time-consuming process in a Prism app I am writing. I have wired it up using a WaitCursorRequestEvent<bool> composite event. 'True' means show the wait cursor, 'false' means go back to default.

The Shell subscribes to the event and processes it using the following event handler:

/// <summary>
/// Handles the WaitCursorRequest event.
/// </summary>
public void OnWaitCursorRequest(bool showWaitCursor)
{
    // Set cursor
    this.Cursor = showWaitCursor ? Cursors.Wait : Cursors.Arrow;
    this.ForceCursor = true;
}

The module that executes the time-consuming process publishes the event with a 'true' payload when it starts the process, and publishes the event again with a 'false' payload when it completes the process.

The event handler is being called on both occasions--I tested by setting a breakpoint. But the cursor isn't changing. Any idea what I am doing wrong? Thanks.

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

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

发布评论

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

评论(1

姜生凉生 2024-08-25 20:05:23

可能还需要设置应用程序范围的光标

Mouse.OverrideCursor = Cursors.Wait

maybe needs to set the application-wide cursor as well

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