Ejemplo n.º 1
0
        //private void MenuListView_ItemClick(object sender, AdapterView.ItemClickEventArgs e)
        //{
        //    var item = allItems[e.Position];

        //    var intent = new Intent();
        //    intent.SetClass(this, typeof(MenuDetailActivity));
        //    intent.PutExtra("selectedItemId", item.ItemId);

        //    StartActivityForResult(intent, 100);
        //}

        protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
        {
            base.OnActivityResult(requestCode, resultCode, data);

            if (resultCode == Result.Ok && requestCode == 100)
            {
                var selectedItem = menuDataService.GetItemById(data.GetIntExtra("selectedItemId", 0));

                var dialog = new AlertDialog.Builder(this);
                dialog.SetTitle("Confirmation");
                dialog.SetMessage($"You've added {data.GetIntExtra("amount", 0)} {selectedItem.Name} to your cart.");
                dialog.Show();
            }
        }
Ejemplo n.º 2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.MenuDetailView);
            var selectedItemId = Intent.Extras.GetInt("selectedItemId");

            dataService = new MenuDataService();

            selectedItem = dataService.GetItemById(selectedItemId);

            FindViews();

            BindData();

            HandleEvents();
        }