public void SprayQualityClicked(Android.Views.View v)
        {
            var sq = BFCDatabase.GetTable <SprayQuality>();

            CreateSelectDialog <SprayQuality>(sq, x => x.Name, "Choose spray quality", selected =>
            {
                var b  = (Button)v;
                b.Text = selected.Name;
                BFCAndroidGlobal.SelectedSprayQuality = selected;
                RefreshResult();
            });
        }
        public void BoomHeightClicked(Android.Views.View v)
        {
            var bh = BFCDatabase.GetTable <BoomHeight>();

            CreateSelectDialog <BoomHeight>(bh, x => x.Name, "Choose boom height", selected =>
            {
                var b  = (Button)v;
                b.Text = selected.Name;
                BFCAndroidGlobal.SelectedBoomHeight = selected;
                RefreshResult();
            });
        }
        public void WindSpeedClicked(Android.Views.View v)
        {
            var ws = BFCDatabase.GetTable <WindSpeed>();

            CreateSelectDialog <WindSpeed>(ws, x => string.Format("From {0} to {1}", x.Min, x.Max), "Choose wind speed", selected =>
            {
                var b  = (Button)v;
                b.Text = string.Format("From {0} to {1}", selected.Min, selected.Max);
                BFCAndroidGlobal.SelectedWindSpeed = selected;
                RefreshResult();
            });
        }
Example #4
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            // Create your application here
            SetContentView(Resource.Layout.SelectItem);

            var adap = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, _items);

            ListAdapter = adap;
            ListView.TextFilterEnabled = true;
            ListView.ChoiceMode        = ChoiceMode.Multiple;

            _listWhat = Intent.GetStringExtra("pick");

            switch (_listWhat)
            {
            case "manufacturer":
            {
                Title = "Pick Manufacturer";
                var manu = BFCDatabase.GetTable <Manufacturer>();
                DisplayListOnUI(manu);
            }
            break;

            case "nozzle":
            {
                Title = "Pick nozzle";
                var n = BFCDatabase.GetNozzleFor(BFCAndroidGlobal.SelectedManufacturer);
                DisplayListOnUI(n);
            }
            break;

            case "pressure":
            {
                Title = "Pick pressure";
                var p = BFCDatabase.GetPressureFor(BFCAndroidGlobal.SelectedNozzle);
                DisplayListOnUI(p);
            }
            break;

            case "waterflow":
            {
                Title = "Pick water flow";
                var wf = BFCDatabase.GetWaterFlowFor(BFCAndroidGlobal.SelectedNozzle);
                DisplayListOnUI(wf);
            }
            break;

            default:
                throw new InvalidOperationException("Invalid list type");
            }
            ((ArrayAdapter)ListAdapter).NotifyDataSetChanged();

            var filterEditText = FindViewById <EditText>(Resource.Id.filterEditText);

            filterEditText.TextChanged += (sender, arg) =>
            {
                var et = (EditText)sender;
                ((ArrayAdapter <string>)ListAdapter).Filter.InvokeFilter(et.Text);
            };
        }