我在CustomMessageBox
左键单击终止时调用异步方法。但它给了我编译时间错误。我搜索了它,但得到了一些关于MessageDialog.Command的信息。我将如何在 windows phone 中实现相同的目标CustomMessageBox
。
这是我的代码
CustomMessageBox customMBox = new CustomMessageBox()
{
Caption = "Alert!",
Message = string.Format("Clicking on clear all will clear all the data on the app. Are you sure you want to proceed?"),
LeftButtonContent = "Yes",
RightButtonContent = "No",
};
customMBox.Dismissed += (s2, e2) =>
{
switch (e2.Result)
{
case CustomMessageBoxResult.LeftButton:
await clearDatabaseAsync();
break;
case CustomMessageBoxResult.RightButton:
break;
case CustomMessageBoxResult.None:
break;
default:
break;
}
};
customMBox.Show();
public async Task clearDatabaseAsync()
{
//SQLite clear table record logic
await App.DeleteDatabase();
}
谁能建议我如何实现这一目标?
提前致谢。