【发布时间】:2019-05-02 18:26:31
【问题描述】:
如何在Caliburn.Micro中屏蔽UI?
public async void AcceptButton()
{
await this.httpDataService.Register(account);
Show.SuccesBox(alert);
this.TryClose();
}
如何通过阻止View 来等待我的ViewModel 中的Task 结束?
编辑
我在xaml 中的按钮上添加了绑定:
IsEnabled="{Binding isEnabled}"
那么,我的VM:
bool isEnabled {get;set;}
public async void AcceptButton()
{
this.isEnabled = false;
await this.httpDataService.Register(account);
Show.SuccesBox(alert);
this.TryClose();
}
在这种情况下,AcceptButton 始终处于非活动状态 IsEnabled=false。如何仅在单击按钮时触发false?
【问题讨论】:
-
是否要阻止用户在运行过程中进行其他操作?
-
是的,我想屏蔽整个应用
-
“如何阻止 UI” - 正确答案是“你不会”。你为什么要这样做?
标签: c# wpf task caliburn.micro