Exemple #1
0
        private async void findCar_Click(object sender, System.EventArgs e)
        {
            int   doesCarExist = 0;
            Lease lease        = new Lease();

            txtSearch = FindViewById <AutoCompleteTextView>(Resource.Id.searchCar).Text;

            await Task.Run(async() =>
            {
                doesCarExist = await new CarService().GetCar(txtSearch);
            });

            switch (doesCarExist)
            {
            case 1:
                await Task.Run(async() => { lease = await new CarService().GetLease(txtSearch); });

                switch (lease.Status)
                {
                case LeaseStatus.Available:
                    var setRentedActivity = new Intent(this, typeof(setRentedActivity));
                    setRentedActivity.PutExtra("findCarInput", txtSearch);
                    StartActivity(setRentedActivity);
                    break;

                case LeaseStatus.Rented:
                    var setDeliveredActivity = new Intent(this, typeof(setDeliveredActivity));
                    setDeliveredActivity.PutExtra("findCarInput", txtSearch);
                    StartActivity(setDeliveredActivity);
                    break;

                default:
                    var setAvailableActivity = new Intent(this, typeof(setAvailableActivity));
                    setAvailableActivity.PutExtra("findCarInput", txtSearch);
                    StartActivity(setAvailableActivity);
                    break;
                }
                break;

            default:
                ConfirmDialog();
                break;
            }
        }
Exemple #2
0
        protected async override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.setRented);

            Lease lease = new Lease();

            RegNr = Intent.GetStringExtra("findCarInput") ?? "Data not available";
            await Task.Run(async() =>
            {
                lease = await new CarService().GetLease(RegNr);
            });

            Latitude   = lease.latitudePickUpLocation;
            Longtitude = lease.longtitudePickUpLocation;
            CarName    = lease.CarName;
            FindViewById <TextView>(Resource.Id.setRented_CarName).Text = CarName;
            FindViewById <ImageView>(Resource.Id.setRented_Image).SetImageBitmap(convertByteToImage(lease.CarPicture.PictureData));
            Confirm        = FindViewById <Button>(Resource.Id.setRented_Confirm);
            Confirm.Click += delegate { ConfirmDialog(); };

            SetUpMap();
        }