1
我正在嘗試使用Caliburn.Micro實現如此的警衛處理,但是當應用程序運行時出現無效的轉換異常。關於Caliburn.Micro的guard子句的錯誤
物業:
public Account UserAccount
{
get
{
return account;
}
set
{
account = value;
NotifyOfPropertyChange(() => UserAccount);
NotifyOfPropertyChange(() => CanSaveAndNavigateToComposeView());
}
}
的方法:
public void SaveAndNavigateToComposeView()
{
CommitAccountToStorage();
navigationService.UriFor<ComposeViewModel>().Navigate();
}
的後衛:
public bool CanSaveAndNavigateToComposeView()
{
return !(string.IsNullOrEmpty(UserAccount.DisplayName) ||
string.IsNullOrEmpty(UserAccount.Username) ||
string.IsNullOrEmpty(UserAccount.Password) ||
string.IsNullOrEmpty(UserAccount.ServerSymbol));
}
,如果我拿出通知對房地產支柱變化警衛工作,但此意味着我的方法永遠不會評估。
爲Rob而歡呼! – deanvmc