0
我有以下代码:在.show AlertDialog没有显示() - Xamarin的Android
private void CloseOrder(object sender, EventArgs e)
{
Android.Support.V7.App.AlertDialog.Builder alert = new Android.Support.V7.App.AlertDialog.Builder(this);
alert.SetTitle("Cerrar Pedido");
alert.SetMessage("Are you sure?");
alert.SetCancelable(true);
alert.SetPositiveButton("Confirm", delegate { this.Rta = true; });
alert.SetNegativeButton("Cancel", delegate { this.Rta = false; });
Dialog dialog = alert.Create();
dialog.Show();
if (this.Rta)
{
//Some code here
}
}
this.Rta是我班的一个属性。
问题是警报没有显示在dialog.show()
,它显示一旦方法CloseOrder()
结束,所以this.Rta
永远不会获得分配的相应值。
我一直在寻找很多,但是我找不到解决方案,如果有人能帮助我,那会很棒!