Esempio n. 1
0
        async void InitializeMakeSpinner()
        {
            var modelList = await RESTClient.GetCarmodelAsync(this);

            Array.Sort(modelList);
            ArrayAdapter <string> dataAdapter = new ArrayAdapter <string>(this, Resource.Layout.Custom_Spinner_Signup, modelList);

            dataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            spnMake.Adapter = dataAdapter;
        }
Esempio n. 2
0
        private async void InitializeVehicleSpinners()
        {
            RunOnUiThread(() =>
            {
                progress.Show();
            });
            var modelList = await RESTClient.GetCarmodelAsync(this);

            RunOnUiThread(() =>
            {
                progress.Dismiss();
            });
            Array.Sort(modelList);
            ArrayAdapter <string> dataAdapter = new ArrayAdapter <string>(this, Resource.Layout.Custom_Spinner_Edit_Details, modelList);

            dataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            spnMake.Adapter = dataAdapter;
            spnMake.SetSelection(dataAdapter.GetPosition(user.Vehicles[0].make));

            spnMake.ItemSelected += async(sender, e) =>
            {
                var makeList = await RESTClient.GetCarmodelMakeAsync(this, spnMake.SelectedItem.ToString().Trim());

                Array.Sort(makeList);
                dataAdapter = new ArrayAdapter <string>(this, Resource.Layout.Custom_Spinner_Edit_Details, makeList);
                dataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
                spnModel.Adapter = dataAdapter;
                spnModel.SetSelection(dataAdapter.GetPosition(user.Vehicles[0].model));
            };

            var adapter = ArrayAdapter.CreateFromResource(this, Resource.Array.car_color_array, Resource.Layout.Custom_Spinner_Edit_Details);

            adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            spnColor.Adapter = adapter;
            spnColor.SetSelection(adapter.GetPosition(user.Vehicles[0].color));
        }