Ejemplo n.º 1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.HotDogDetailView);

            var selectedDogId = Intent.Extras.GetInt("selectedHotDogId");

            _selectedHotDog = _dataService.GetHotDog(selectedDogId);

            FindViews();
            BindData();
            HandleEvents();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Called when an activity exits, giving you the requestCode you started it with, the resultCode it returned, and any additional data from it.
        /// </summary>
        /// <param name="requestCode">The integer request code originally supplied to startActivityForResult(), allowing you to identify who this result came from.</param>
        /// <param name="resultCode">The integer result code returned by the child activity through its setResult().</param>
        /// <param name="data">An Intent, which can return result data to the caller (various data can be attached to Intent "extras").</param>
        protected override void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent data)
        {
            base.OnActivityResult(requestCode, resultCode, data);

            if (resultCode != Result.Ok || requestCode != 100)
            {
                return;
            }

            var selectedDog = _dataService.GetHotDog(data.GetIntExtra("selectedHotDogId", 0));

            var dialog = new AlertDialog.Builder(this);

            dialog.SetTitle("Confirmation");
            dialog.SetMessage($"You've added {data.GetIntExtra("amount", 0)} {selectedDog.Name} to your basket.");
            dialog.Show();
        }