Ejemplo n.º 1
0
        private void MSaveButton_Click(object sender, EventArgs e)
        {
            mCheckedRadioButton = mMainView.FindViewById <RadioButton>(mPricingTypeRadioGrp.CheckedRadioButtonId);
            if (mCurrentPricingType != SelectedPrice(mCheckedRadioButton.Text) &&
                GlobalVariables.globalProductsOnCart.Count > 0)
            {
                Android.App.AlertDialog.Builder builder = new Android.App.AlertDialog.Builder(this.Context);
                Android.App.AlertDialog         alert   = builder.Create();
                alert.SetTitle("Warning");
                alert.SetMessage("Changing the price type will clear the cart. Continue?");

                alert.SetButton2("CANCEL", (c, ev) =>
                {
                    //cancel button
                });

                alert.SetButton("YES", (c, ev) =>
                {
                    SelectPricingType();
                    this.Dismiss();
                });
                alert.Show();
            }
            else
            {
                SelectPricingType();
                this.Dismiss();
            }
        }
        private void List_ItemClick(object sender, AdapterView.ItemClickEventArgs e)
        {
            // Item Medicamento
            _medicamento = _listMedicamentos[e.Position];

            if (_medicamento.confirmar == true)
            {
                Android.App.AlertDialog.Builder dialog = new AlertDialog.Builder(Activity);
                AlertDialog alert = dialog.Create();
                alert.SetTitle("Medicamento");
                alert.SetMessage("Ya ha sido confirmado!");
                alert.SetButton("Cerrar", delegate
                {
                    alert.Dispose();
                });

                alert.Show();
            }
            else
            {
                AlertDialog.Builder dialog = new AlertDialog.Builder(Activity);
                AlertDialog         alert  = dialog.Create();
                alert.SetTitle("Medicamento");
                alert.SetIcon(Resource.Drawable.logo);
                alert.SetButton("Confirmar", (c, ev) =>
                {
                    //_medicamento = _listMedicamentos[e.Position];
                    _medicamento.confirmar = true;                       // Confirmar Medicamento
                    _medicamentoService.updateMedicamento(_medicamento); // Actualiza el registro en la base de datos

                    // Para refresh
                    Activity.Finish(); StartActivity(Activity.Intent);

                    GC.Collect();
                });

                alert.SetButton2("Omitir", (c, ev) => { });
                alert.Show();
            }
        }