WPF 在应用程序完全加载之前显示等待光标

发布于 2024-09-04 01:29:57 字数 1136 浏览 0 评论 0原文

我想在使用 CAL 组成的 WPF 应用程序完全加载之前显示等待光标。

在主窗口的构造函数中,我有以下代码:

 public MainWindow([Dependency] IUnityContainer container)
        {                                                            

            InitializeComponent();

            Cursor = System.Windows.Input.Cursors.Wait;
            Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait;
            ForceCursor = true;

            //this.Cursor = System.Windows.Input.Cursors.AppStarting;

            // event subscriptions            

            PresenterBase.EventAggregate.GetEvent<ModulesLoadedEvent>().Subscribe(OnModulesLoaded);                                                               
        }

加载所有模块后,调用以下处理程序:

 private void OnModulesLoaded(EventArgs e)
        {
            allModulesLoaded = true;
            Mouse.OverrideCursor = null;
            Cursor = System.Windows.Input.Cursors.Arrow;

        }    

问题是,我没有看到此等待光标。我在这里缺少什么? FWIW,我从这篇文章中得到了提示

显示等待光标?

TIA。

I want to show the wait cursor before my WPF application, composed using CAL, fully loads.

In the constructor of the main window, I have the following code:

 public MainWindow([Dependency] IUnityContainer container)
        {                                                            

            InitializeComponent();

            Cursor = System.Windows.Input.Cursors.Wait;
            Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait;
            ForceCursor = true;

            //this.Cursor = System.Windows.Input.Cursors.AppStarting;

            // event subscriptions            

            PresenterBase.EventAggregate.GetEvent<ModulesLoadedEvent>().Subscribe(OnModulesLoaded);                                                               
        }

After all modules have been loaded, the following handler is invoked:

 private void OnModulesLoaded(EventArgs e)
        {
            allModulesLoaded = true;
            Mouse.OverrideCursor = null;
            Cursor = System.Windows.Input.Cursors.Arrow;

        }    

Problem is, I do not see this wait cursor. What I am missing here? FWIW, I got a hint from this post

Showing the Wait Cursor?

TIA.

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

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

发布评论

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

评论(1

染柒℉ 2024-09-11 01:29:57

在您的应用程序中找到 Prism 引导程序,并在尝试加载 Prism 模块之前将等待光标代码放在某处。

Find the Prism bootstrapper in your app, and put the wait cursor code somewhere before you attempt to load the Prism modules.

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