【发布时间】:2020-05-29 09:23:46
【问题描述】:
我有一个使用 Caliburn Micro 的小型 WPF 应用程序示例。在其中,我有一个矩形叠加层,上面写着加载。我希望在加载大型任务时出现,但是直到方法完成后才会出现。我尝试过使用 Dispatch 以及其他建议,但是在按钮方法完成之前没有任何效果。以下是我当前的示例
public async void TheActionButton()
{
//Application.Current.Dispatcher.Invoke(new System.Action(() => { IsLoadingMessageVisible = true; NotifyOfPropertyChange(() => IsLoadingMessageVisible); }));
Execute.OnUIThread(new System.Action(() => { IsLoadingMessageVisible = true; NotifyOfPropertyChange(() => IsLoadingMessageVisible); }));
await LongMethod();
}
覆盖仅在 LongMethod() 运行完成后显示。有没有办法让它在方法运行之前显示?
【问题讨论】:
-
LongMethod是如何实现的?尽管有签名,但它可能不是异步的。
标签: c# wpf .net-core caliburn.micro