显示等待光标? [英] Showing the Wait Cursor?

查看:44
本文介绍了显示等待光标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我正在编写的 Prism 应用程序中的耗时过程中显示等待光标.我已经使用 WaitCursorRequestEvent 复合事件将它连接起来.'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.

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

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;
}

执行耗时流程的模块在启动流程时使用true"有效负载发布事件,并在完成流程时使用false"有效负载再次发布事件.

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.

推荐答案

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

maybe needs to set the application-wide cursor as well

Mouse.OverrideCursor = Cursors.Wait

这篇关于显示等待光标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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