private void _testCoordinates_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e) { //pause test coordinates if (_locationManager != null) { _locationManager.RemoveUpdates(this); } Spinner spinner = (Spinner)sender; string toast = string.Format("the coordinates are {0}", spinner.GetItemAtPosition(e.Position)); if (e.Position != 0) { Location dummyLocation = new Location("test"); string[] split_coords = spinner.GetItemAtPosition(e.Position).ToString().Split(','); double lat = 0, lng = 0; if (!double.TryParse(split_coords[0], out lat) || !double.TryParse(split_coords[1], out lng)) { Toast.MakeText(this, "ERROR, Cannot parse lat & long", ToastLength.Short).Show(); return; } else { dummyLocation.Latitude = lat; dummyLocation.Longitude = lng; OnLocationChanged(dummyLocation); //force an update from the server firstTimeThrough = true; Toast.MakeText(this, toast, ToastLength.Long).Show(); } Toast.MakeText(this, toast, ToastLength.Long).Show(); } }
private async void spinner_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e) { Spinner spinner = (Spinner)sender; string toast = string.Format("Selected language is {0}", spinner.GetItemAtPosition(e.Position)); string toLanguage = string.Format("{0}", spinner.GetItemAtPosition(e.Position)); if (toLanguage == "English") { toLanguage = "en"; } else if (toLanguage == "Hindi") { toLanguage = "hi"; } else if (toLanguage == "Marathi") { toLanguage = "mr"; } string[] results = await GetTranslatedText(toLanguage); var temperatureSummary = FindViewById <TextView>(Resource.Id.temperatureSummary); var soilSummary = FindViewById <TextView>(Resource.Id.soilSummary); var areaSummary = FindViewById <TextView>(Resource.Id.areaSummary); temperatureSummary.Text = results[0]; soilSummary.Text = results[1]; areaSummary.Text = results[2]; currentLanguage = toLanguage; }
private void spinner_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e) { Spinner spinner = (Spinner)sender; String tag = spinner.GetTag(Resource.String.tagPizza).ToString(); String toast = ""; if (tag == "massa") { toast = string.Format("Massa {0} selecionada", spinner.GetItemAtPosition(e.Position)); massaSel = string.Format("{0}", spinner.GetItemAtPosition(e.Position)); } else { toast = string.Format("Tamanho {0}", spinner.GetItemAtPosition(e.Position)); tamanhoSel = string.Format("{0}", spinner.GetItemAtPosition(e.Position)); } if (!(e.Position == 0)) { Toast.MakeText(this, toast, ToastLength.Long).Show(); } Console.Write(tag); }
private void Doktor_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e) { Spinner spinner = (Spinner)sender; rdoktor = spinner.GetItemAtPosition(e.Position).ToString(); saatlistAsync k = new saatlistAsync(this); k.Execute(); //saat seçimi if (rdoktor == "Doktor Seçiniz") { saat.Visibility = ViewStates.Invisible; ronayla.Visibility = ViewStates.Invisible; rdoktor = spinner.GetItemAtPosition(e.Position).ToString(); } else { rdoktor = spinner.GetItemAtPosition(e.Position).ToString(); var adapter4 = new ArrayAdapter(this, Android.Resource.Layout.SimpleSpinnerItem, clocks); adapter4.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); saat.Adapter = adapter4; saat.Visibility = ViewStates.Visible; saat.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(Saat_ItemSelected); saatlistAsync n = new saatlistAsync(this); n.Execute(); } rdoktor = spinner.GetItemAtPosition(e.Position).ToString(); }
private void Tarih_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e) { Spinner spinner = (Spinner)sender; rtarih = spinner.GetItemAtPosition(e.Position).ToString(); if (rtarih == "Tarih Seçiniz") { doktor.Visibility = ViewStates.Invisible; saat.Visibility = ViewStates.Invisible; ronayla.Visibility = ViewStates.Invisible; rtarih = spinner.GetItemAtPosition(e.Position).ToString(); } else { rtarih = spinner.GetItemAtPosition(e.Position).ToString(); doktorlistAsync n = new doktorlistAsync(this); n.Execute(); var adapter3 = new ArrayAdapter(this, Android.Resource.Layout.SimpleSpinnerItem, doktorlist); adapter3.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); doktor.Adapter = adapter3; doktor.Visibility = ViewStates.Visible; doktor.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(Doktor_ItemSelected); } rtarih = spinner.GetItemAtPosition(e.Position).ToString(); }
private void spinner_ItemSelectedPrev(object sender, AdapterView.ItemSelectedEventArgs e) { Spinner spinner = (Spinner)sender; string toast = string.Format("The planet is {0}", spinner.GetItemAtPosition(e.Position)); Toast.MakeText(this, toast, ToastLength.Long).Show(); txtTipoPrev = spinner.GetItemAtPosition(e.Position).ToString(); if (txtTipoPrev.Equals("Isapre")) { spinnerPrevision.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(spinner_ItemSelectedPrevisionIsapre); var adapter1 = ArrayAdapter.CreateFromResource( this, Resource.Array.Dropdown_arraysPrevIsapre, Android.Resource.Layout.SimpleSpinnerItem); adapter1.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); spinnerPrevision.Adapter = adapter1; } else if (txtTipoPrev.Equals("Fonasa")) { spinnerPrevision.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(spinner_ItemSelectedPrevisionFonasa); var adapter1 = ArrayAdapter.CreateFromResource( this, Resource.Array.Dropdown_arraysPrevFonasa, Android.Resource.Layout.SimpleSpinnerItem); adapter1.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); spinnerPrevision.Adapter = adapter1; } }
private void Spinner_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e) { Spinner spinner = (Spinner)sender; if (spinner.GetItemAtPosition(e.Position).Equals("minute")) { i = 0; } else if (spinner.GetItemAtPosition(e.Position).Equals("hour")) { i = 1; } else if (spinner.GetItemAtPosition(e.Position).Equals("day")) { i = 2; } else if (spinner.GetItemAtPosition(e.Position).Equals("week")) { i = 3; } else { i = 4; } if (jsonDoc != null) { switch (i) { case 0: ParseAndDisplay(jsonDoc, i); break; case 1: ParseAndDisplay(jsonDoc, i); break; case 2: ParseAndDisplay(jsonDoc, i); break; case 3: ParseAndDisplay(jsonDoc, i); break; case 4: ParseAndDisplay(jsonDoc, i); break; default: Toast.MakeText(ApplicationContext, "Something worng", ToastLength.Long).Show(); break; } } else { string message = "No DATA"; Toast.MakeText(ApplicationContext, message, ToastLength.Long).Show(); } }
private void Spinner_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e) { itemText = spinner.GetItemAtPosition(e.Position).ToString(); string item = itemText; switch (itemText) { case "l": item = "Litar"; break; case "ml": item = "Mililitar"; break; case "kg": item = "Kilogram"; break; case "g": item = "Gram"; break; default: itemText = spinner.GetItemAtPosition(e.Position).ToString(); break; } string toast = string.Format("Merna jedinica koju ste izabrali je: " + item); if (flag == true) { Toast.MakeText(this, toast, ToastLength.Long).Show(); } flag = true; }
private void spinner2_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e) { Spinner spinner = (Spinner)sender; string toast = string.Format("Wybrany kolor: {0}", spinner.GetItemAtPosition(e.Position)); Toast.MakeText(this.Activity, toast, ToastLength.Short).Show(); color = spinner.GetItemAtPosition(e.Position).ToString(); }
/* * Method name: spinner_ItemSelected * Purpose: To determine what item has been selected on the spinner */ public void spinner_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e) { Spinner spinner = (Spinner)sender; string toast = string.Format("{0} selected", spinner.GetItemAtPosition(e.Position)); Toast.MakeText(_context, toast, ToastLength.Long).Show(); _selectedValue = (string)spinner.GetItemAtPosition(e.Position); }
private void spinner_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e) { Spinner spinner = (Spinner)sender; string toast = string.Format("The system is {0}", spinner.GetItemAtPosition(e.Position)); Toast.MakeText(this, toast, ToastLength.Long).Show(); system = spinner.GetItemAtPosition(e.Position).ToString(); }
private void sourcespinner_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e) { Spinner sourcespinner = (Spinner)sender; string toast = string.Format("The planet is {0}", sourcespinner.GetItemAtPosition(e.Position)); _sourceAccount = sourcespinner.GetItemAtPosition(e.Position).ToString(); //Toast.MakeText(this, toast, ToastLength.Long).Show(); }
/// <summary> /// Spinners the item selected. /// </summary> /// <param name="sender">The object that invoked the event</param> /// <param name="e">The event arguments</param> private void spinner_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e) { Spinner spinner = (Spinner)sender; //Save the name of the user selected for use in sending a message userSelected = string.Format("{0}", spinner.GetItemAtPosition(e.Position)); string toast = string.Format("User is {0}", spinner.GetItemAtPosition(e.Position)); Toast.MakeText(this, toast, ToastLength.Long).Show(); }
private void ChooseItem(object sender, EventArgs e) { if (type.SelectedItem.ToString() == type.GetItemAtPosition(0).ToString()) { DisplayPieChart(); } if (type.SelectedItem.ToString() == type.GetItemAtPosition(1).ToString()) { DisplayLinearGraph(); } }
private void spinner_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e) { Spinner spinner = (Spinner)sender; FindViewById <TextView>(Resource.Id.textView2).Text = "For car " + spinner.GetItemAtPosition(e.Position).ToString() + " per day(s) is $" + planets[e.Position].Value; price = planets[e.Position].Value; string toast = string.Format("Selected car is {0}", spinner.GetItemAtPosition(e.Position)); Toast.MakeText(this, toast, ToastLength.Long).Show(); }
private void spinnerLocation_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e) { Spinner spinner = (Spinner)sender; var locStr = Convert.ToString(spinner.GetItemAtPosition(e.Position)); var locModel = UserSession.Locations.Where(x => x.Value == locStr).FirstOrDefault(); if (locModel != null) { userModel.Location = locModel.GUID; userModel.LocationStr = Convert.ToString(spinner.GetItemAtPosition(e.Position)); } }
public void spinner_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e) { Console.WriteLine("spinner_ItemSelected() " + this.selectedItem); Spinner spinner = (Spinner)sender; if (Convert.ToString(spinner.GetItemAtPosition(e.Position)) != this.selectedItem) { this.selectedItem = Convert.ToString(spinner.GetItemAtPosition(e.Position)); changeView(); Console.WriteLine("Writeline in the if statement " + this.selectedItem); } Console.WriteLine(this.selectedItem); }
private void Delete_Click(object sender, EventArgs e) { if (horseName.Count == 0) { Intent i = new Intent(this, typeof(MainActivity)); StartActivity(i); Toast.MakeText(this, "Nie ma zapisanych diet!", ToastLength.Long).Show(); } NullSpinnerChecker(); sd.Delete(horseName.GetItemAtPosition(selected).ToString()); this.Recreate(); Toast.MakeText(this, "Usunięto pomyślnie!", ToastLength.Long).Show(); }
private void Music_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e) { Spinner spinner = (Spinner)sender; string name = spinner.GetItemAtPosition(e.Position).ToString(); string toast = string.Format("Music = {0}; Value = {1}", spinner.GetItemAtPosition(e.Position), sounds[e.Position].Value); Toast.MakeText(this, toast, ToastLength.Long).Show(); string sendText = "3" + sounds[e.Position].Value; SendStringToArduino(sendText, MIPStatusText); }
private void spinner_ItemSelectedRegion(object sender, AdapterView.ItemSelectedEventArgs e) { Spinner spinnerRegion = (Spinner)sender; string toast = string.Format("{0}", spinnerRegion.GetItemAtPosition(e.Position)); Toast.MakeText(this, toast, ToastLength.Long).Show(); if (spinnerRegion.GetItemAtPosition(e.Position).ToString().Equals("Región Metropolitana de Santiago")) { spinnerCiudad.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(spinner_ItemSelectedCiudad); var adapterCiudad = ArrayAdapter.CreateFromResource( this, Resource.Array.Dropdown_arraysCiudadesMetropo, Android.Resource.Layout.SimpleSpinnerItem); adapterCiudad.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); spinnerCiudad.Adapter = adapterCiudad; } }
private void spinnerRole_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e) { Spinner spinner = (Spinner)sender; userModel.Role = e.Position; userModel.RoleStr = Convert.ToString(spinner.GetItemAtPosition(e.Position)); }
private void SubFormaCaudalComentarios(double lGpsLat, double lGpsLong) { cObjInicio.cTran = new Transaccion(); cObjInicio.cTranDet = new List <TransaccionDet>(); cObjInicio.cTran.Codigo = Guid.NewGuid(); cObjInicio.cTran.Cuenca = SpCuena.GetItemAtPosition(SpCuena.SelectedItemPosition).ToString(); cObjInicio.cTran.SubCuenca = SpSubCuena.GetItemAtPosition(SpSubCuena.SelectedItemPosition).ToString(); cObjInicio.cTran.PuntoMonitoreo = SpPuntoMonitoreo.GetItemAtPosition(SpPuntoMonitoreo.SelectedItemPosition).ToString(); cObjInicio.cTran.ModeloMolinete = SpModeloMolinete.GetItemAtPosition(SpModeloMolinete.SelectedItemPosition).ToString(); cObjInicio.cTran.TipoMedicion = SpTipoMedicion.GetItemAtPosition(SpTipoMedicion.SelectedItemPosition).ToString(); cObjInicio.cTran.Tipologia = SpTipologia.GetItemAtPosition(SpTipologia.SelectedItemPosition).ToString(); cObjInicio.cTran.FechaHoraInicial = DateTime.Now; cObjInicio.cTran.FechaHoraFinal = DateTime.Now; cObjInicio.cTran.GpsLatitud = lGpsLat; cObjInicio.cTran.GpsLongitud = lGpsLong; cObjInicio.cTran.Estado = "Solicitud Pendiente de Revisar"; cObjInicio.cTran.Usuario = cObjInicio.cUsuario; cProc.Hide(); Intent lObjIntent = null; if (cObjInicio.cBlnTipoMedidicion) { lObjIntent = new Intent(this, typeof(ListadoCaudalActivity)); } else { lObjIntent = new Intent(this, typeof(ComentarioActivity)); } StartActivity(lObjIntent); }
private void sType_spinner_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e) { Spinner spinner = (Spinner)sender; String selectedItem = spinner.GetItemAtPosition(e.Position).ToString(); if (sfschedule != null) { monthViewLayout.Visibility = ViewStates.Invisible; otherviewsLayout.Visibility = ViewStates.Visible; if (selectedItem.Equals("Day View")) { sfschedule.ScheduleView = ScheduleView.DayView; } else if (selectedItem.Equals("Week View")) { sfschedule.ScheduleView = ScheduleView.WeekView; sfschedule.EnableNavigation = true; } else if (selectedItem.Equals("Work Week View")) { sfschedule.ScheduleView = ScheduleView.WorkWeekView; } else if (selectedItem.Equals("Month View")) { monthViewLayout.Visibility = ViewStates.Visible; otherviewsLayout.Visibility = ViewStates.Invisible; sfschedule.ScheduleView = ScheduleView.MonthView; } } }
private void SpinnerItemSelected(object sender, AdapterView.ItemSelectedEventArgs e) { Spinner spinner = (Spinner)sender; string toast; var selectedItem = spinner.GetItemAtPosition(e.Position).ToString(); int selectedValue = int.Parse(selectedItem); switch (spinner.Id) { case Resource.Id.sets_spinner: toast = string.Format("{0} sets", selectedItem); selectedSets.Text = selectedItem; numSets = selectedValue; //Toast.MakeText(this, toast, ToastLength.Long).Show(); break; case Resource.Id.legs_per_set_spinner: toast = string.Format("{0} legs per set", selectedItem); selectedLegsPerSet.Text = selectedItem; numLegsPerSet = selectedValue; //Toast.MakeText(this, toast, ToastLength.Long).Show(); break; case Resource.Id.start_score_spinner: toast = string.Format("{0} start", selectedItem); selectedStartScore.Text = selectedItem; startScore = selectedValue; //Toast.MakeText(this, toast, ToastLength.Long).Show(); break; } }
//event for when the category dropdown changes private void Category_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e) { Spinner spinner = (Spinner)sender; //if the selection contains the text "transfer" clear the type_toaccount dropdown and load it with all accounts besides the current account if (spinner.GetItemAtPosition(e.Position).ToString().Contains("Transfer")) { transactionTypeToAccountAdapter.Clear(); foreach (Account act in MainActivity.accounts) { if (act.PK != accountPK) { transactionTypeToAccountAdapter.Add(act.Name); } } defaultTypeToAccountLoaded = false; } //if the selection is anything else besides transfer clear and load the tyep_toaccount dropdown back to default else { if (defaultTypeToAccountLoaded == false) { transactionTypeToAccountAdapter.Clear(); transactionTypeToAccountAdapter.Add("Withdrawal"); transactionTypeToAccountAdapter.Add("Deposit"); defaultTypeToAccountLoaded = true; } } }
private void spinner_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e) { if (sender.Equals(spinnerHour)) { spinnerHour = (Spinner)sender; ahour = spinnerHour.GetItemAtPosition(e.Position).ToString(); } else if (sender.Equals(spinnerMinutes)) { spinnerMinutes = (Spinner)sender; amin = spinnerMinutes.GetItemAtPosition(e.Position).ToString(); } else if (sender.Equals(spinnerDay)) { spinnerDay = (Spinner)sender; aday = spinnerDay.GetItemAtPosition(e.Position).ToString(); } else if (sender.Equals(spinnerMonth)) { spinnerMonth = (Spinner)sender; amonth = spinnerMonth.GetItemAtPosition(e.Position).ToString(); } else if (sender.Equals(spinnerServices)) { spinnerServices = (Spinner)sender; aservice = services[e.Position].service; } }
private void spinner_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e) { Spinner spinner = (Spinner)sender; string [] codedesc = spinner.GetItemAtPosition(e.Position).ToString().Split(new char[] { '|' }); string icode = codedesc[0].Trim(); Item item = items.Where(x => x.ICode == icode).FirstOrDefault(); TextView tax = FindViewById <TextView> (Resource.Id.txttax); EditText price = FindViewById <EditText> (Resource.Id.txtprice); //EditText taxper = FindViewById<EditText> (Resource.Id.txtinvtaxper); //CheckBox isincl = FindViewById<CheckBox> (Resource.Id.txtinvisincl); EditText qty = FindViewById <EditText> (Resource.Id.txtqty); // desc.Text = item.IDesc; if (FIRSTLOAD == "") { double uprice = Utility.GetUnitPrice(trd, item); price.Text = uprice.ToString(); } else { FIRSTLOAD = ""; } tax.Text = item.taxgrp; taxper = item.tax; isInclusive = item.isincludesive; qty.RequestFocus(); //ShowKeyBoard (qty); }
void Spinner_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e) { Spinner spinner = (Spinner)sender; try { //combina duas cadeias de caracteres em um caminho string dbPath = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "Usuario.db"); // Cria o Banco de Dados //cria o banco de dados se ele não existir var db = new SQLiteConnection(dbPath); var dados = db.Table <DiarioExercicio>(); //Chama Tabela string data = spinner.GetItemAtPosition(e.Position).ToString(); //verifica a existência do usuário DiarioExercicio tbdiario = new DiarioExercicio(); tbdiario = dados.Where(x => x.Data == data).FirstOrDefault(); txtExibirExercicio.Text = tbdiario.Exercicio; txtExibirData.Text = tbdiario.Data; txtExibirPeso.Text = tbdiario.Peso; txtExibirTempo.Text = tbdiario.Tempo; txtExibirUsuario.Text = tbdiario.Usuario; } catch (Exception ex) { Toast.MakeText(this, ex.ToString(), ToastLength.Short).Show(); } }
// Executes on spinner1 selection. private void Spinner1_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e) { Spinner spinner1 = (Spinner)sender; selection1 = spinner1.GetItemAtPosition(e.Position).ToString(); if (!selection1.Contains("Select")) { convertFrom = selection1.Substring(0, 3); if (selection2.Contains("Select")) { Thread thread = new Thread(new ThreadStart(RequestJson)); // Threading allows sharp response times on initial json request. thread.Start(); } else { RequestJson(); } if (!selection2.Contains("Select") || selection1 != selection2) { if (input == 1) { DisplayDefaults(); } else { DisplayResults(); } } } }
void spinnerFriends5_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e) { Spinner spinner = (Spinner)sender; var contact = spinner.GetItemAtPosition(e.Position).Cast <Contact>(); coord5 = new GeoCoordinate(contact.Latitude, contact.Longitude); }
private int GetSpinnerPosition(Spinner spinner, string key) { for (var i = 0; i < spinner.Count; i++) { var item = (string)spinner.GetItemAtPosition(i); if (key.Equals(item)) return i; } return -1; }