Ken*_*art 17
使用服务:
public void SomeMethodInYourViewModel()
{
try
{
DoSomethingDangerous();
}
catch (Exception ex)
{
ServiceLocator.Resolve<IMessageService>().ShowMessage(ex.Message);
}
}
Run Code Online (Sandbox Code Playgroud)
您现在已经将VM与消息的呈现分离.您甚至可能决定不使用标准(丑陋)消息框,这不会影响您的VM.
| 归档时间: |
|
| 查看次数: |
7404 次 |
| 最近记录: |