private void HandleNegativeButtonClick(object sender, DialogClickEventArgs e) { var dialog = (AlertDialog)sender; using (var db = new ExpenseManager()) { db.DeleteItem(expense); } if (expense.CategoryId == 1 && expense.Date.Month == DateTime.Today.Month) { float bills = Application.Context.GetSharedPreferences ("MyNumbers", FileCreationMode.Private).GetFloat("EstBills", 0); float estBills = bills + (float)expense.Amount; Application.Context.GetSharedPreferences("MyNumbers", FileCreationMode.Private). Edit().PutFloat("EstBills", estBills).Commit(); } dialog.Dismiss(); }