我有MessageDialog
负责删除确认的对话。
private async void ShowDialogClick(object sender, RoutedEventArgs e)
{
MessageDialog md = new MessageDialog("Are your sure you want to delete this?");
md.Commands.Add(new UICommand("Delete",
new UICommandInvokedHandler(DeleteItemHandler)));
md.Commands.Add(new UICommand("Cancel"));
await md.ShowAsync();
}
当用户单击Delete
时,DeleteItemHandler
调用对数据库的操作,但是如何通知用户操作不成功?
我试图创建新的 MessageDialog,但我得到了win32 exception
.
private async void DeleteItemHandler(IUICommand command)
{
MessageDialog md = new MessageDialog("New content");
String result = DbDeletation();
if(result != "OK")
await md.ShowAsync();
}
通知用户错误的最佳方式是什么?