private void spinner_ItemSelectedTipoDiabetes(object sender, AdapterView.ItemSelectedEventArgs e) { Spinner spinner = (Spinner)sender; string toast = string.Format("La id de Diabetes seleccionada es:{0}", spinner.GetItemIdAtPosition(e.Position + 1)); Toast.MakeText(this, toast, ToastLength.Long).Show(); idtipoDiabetes = int.Parse(spinner.GetItemIdAtPosition(e.Position + 1).ToString()); }
private void spinnerSelected(object sender, AdapterView.ItemSelectedEventArgs e) { Spinner spinner = (Spinner)sender; Spinner air = FindViewById <Spinner>(Resource.Id.foundAirSpinner); Spinner iwater = FindViewById <Spinner>(Resource.Id.foundWaterSpinner); Spinner fwater = FindViewById <Spinner>(Resource.Id.fromWaterSpinner); Spinner body = FindViewById <Spinner>(Resource.Id.bodyCondSpinner); switch (spinner.Id) { case Resource.Id.bodyCondSpinner: { if (spinner.GetItemIdAtPosition(e.Position) >= 6) { common.setW = 1; common.setA = -2; iwater.Enabled = true; air.Enabled = false; } else { common.setW = 0; iwater.Enabled = false; air.Enabled = true; } } common.setP = Convert.ToInt32(spinner.GetItemIdAtPosition(e.Position)); break; case Resource.Id.foundAirSpinner: common.setA = Convert.ToInt32(air.GetItemIdAtPosition(e.Position)); common.setPA = common.setW = -1; break; case Resource.Id.foundWaterSpinner: if (spinner.GetItemIdAtPosition(e.Position) == 2) { fwater.Enabled = true; common.setPA = 0; } else { fwater.Enabled = false; } common.setA = -2; common.setW = Convert.ToInt32(iwater.GetItemIdAtPosition(e.Position)); break; case Resource.Id.fromWaterSpinner: common.setA = -2; common.setPA = Convert.ToInt32(fwater.GetItemIdAtPosition(e.Position)); break; } }
private void SpinerDorucakOnItemSelected(object sender, AdapterView.ItemSelectedEventArgs itemSelectedEventArgs) { Spinner spiner = (Spinner)sender; this.brojDorucka = (int)spiner.GetItemIdAtPosition(itemSelectedEventArgs.Position); IzracunajUkupnuCenu(); }
private void spinner_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e) { Spinner spinner = (Spinner)sender; select = (int)spinner.GetItemIdAtPosition(e.Position); string toast = string.Format("Selected car is {0}", spinner.GetItemAtPosition(e.Position)); Toast.MakeText(this, toast, ToastLength.Long).Show(); }
private void moeda2_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e) { Spinner moeda2 = (Spinner)sender; TextView hdnMoeda2 = FindViewById <TextView>(Resource.Id.hdnMoeda2); var item = moeda2.GetItemAtPosition(e.Position); long posicao = moeda2.GetItemIdAtPosition(e.Position); hdnMoeda2.Text = (Resources.GetStringArray(Resource.Array.cotacaocompra_array))[posicao]; }
// If an bike is selected public void spinner_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e) { Spinner spinner = (Spinner)sender; if (spinner.GetItemIdAtPosition(e.Position) != 0) { string toast = string.Format("De geselecteerde locatie is: {0}", spinner.GetItemAtPosition(e.Position)); Toast.MakeText(this, toast, ToastLength.Long).Show(); // Change camara to the selected location int counter = 0; List <string[]> savedLocations = General.GetSavedLocations(this); foreach (string[] savedLocation in savedLocations) { counter++; if (counter == spinner.GetItemIdAtPosition(e.Position)) { map.MoveCamera(CameraUpdateFactory.NewLatLngZoom(new LatLng(Double.Parse(savedLocation[1]), Double.Parse(savedLocation[2])), 18)); } } } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ViewGroup root = (ViewGroup)inflater.Inflate(Resource.Layout.layout_ticketjuridico, null); TextView txtCorreo = root.FindViewById <TextView> (Resource.Id.txtEmail); TextView txtNombre = root.FindViewById <TextView> (Resource.Id.txtNombreApellido); TextView txtAvisoPrivacidad = root.FindViewById <TextView> (Resource.Id.txtAvisoPrivacidad); if (!string.IsNullOrEmpty(TipsFragment.Email)) { txtCorreo.Text = TipsFragment.Email.Trim(); } if (!string.IsNullOrEmpty(TipsFragment.Nombre)) { txtNombre.Text = TipsFragment.Nombre.Trim(); } //cocoservices.tinnova.mx.COCOService cliente = new Navigation_View.cocoservices.tinnova.mx.COCOService (); services_911consumidor_com.COCOService cliente = new Navigation_View.services_911consumidor_com.COCOService(); //cliente.ChannelFactory.CreateChannel (); string string_key = "41f579fc-1445-4065-ab10-c06d50e724d3"; Typeface font = Typeface.CreateFromAsset(Application.Context.Assets, "Fonts/HelveticaNeue-Thin.otf"); Button btnRegistrar = root.FindViewById <Button> (Resource.Id.btnAceptar); btnRegistrar.SetTypeface(font, TypefaceStyle.Normal); txtAvisoPrivacidad.Click += (object sender, EventArgs e) => { var uri = Android.Net.Uri.Parse("http://www.911Consumidor.com/avisoPrivacidad"); var intent = new Intent(Intent.ActionView, uri); StartActivity(intent); }; btnRegistrar.Click += (object sender, EventArgs e) => { btnRegistrar.SetBackgroundColor(Color.White); btnRegistrar.SetTextColor(Color.Orange); string strError = ""; //EditText txtNombre = root.FindViewById<EditText> (Resource.Id.txtNombreApellido); EditText txtTelefono = root.FindViewById <EditText> (Resource.Id.txtPhone); Spinner ddEstado = root.FindViewById <Spinner> (Resource.Id.ddlEstado); EditText txtCiudad = root.FindViewById <EditText> (Resource.Id.txtCiudad); EditText txtNota = root.FindViewById <EditText> (Resource.Id.txtNota); Drawable icon_error = Resources.GetDrawable(Resource.Drawable.Error128); //cliente.ChannelFactory = try { Ticket ticket = new Ticket(); // if (!string.IsNullOrEmpty (txtNombre.Text.Trim ())) // ticket.Nombre = txtNombre.Text.Trim (); // else { // txtNombre.SetError ("Es requerido un Nombre ", icon_error); // strError += "Nombre"; // } ticket.Email = txtCorreo.Text.Trim(); if (!string.IsNullOrEmpty(txtTelefono.Text.Trim())) { ticket.Telefono = txtTelefono.Text.Trim(); } else { txtTelefono.SetError("Es requerido un Telefono ", icon_error); strError += "Telefono"; } if (!string.IsNullOrEmpty(txtNota.Text.Trim())) { ticket.Nota = txtNota.Text.Trim(); } else { txtNota.SetError("Es requerido un Comentario ", icon_error); strError += "Comentario"; } ticket.Ciudad = txtCiudad.Text.Trim(); ticket.Estado = ddEstado.SelectedItem.ToString(); var resultado = 0; if (string.IsNullOrEmpty(strError)) { resultado = cliente.CreateTicket( new Navigation_View.services_911consumidor_com.TicketDTO { Client = new Navigation_View.services_911consumidor_com.UserDTO { FirstName = ticket.Nombre, LastName = string.Empty, Email = ticket.Email, Phone = ticket.Telefono, PostalCode = string.Empty, AddressCity = ticket.Ciudad, AddressState = ticket.Estado }, Status = new Navigation_View.services_911consumidor_com.StatusDTO { OBJ_ID = 2, Id = 3 }, Type = new Navigation_View.services_911consumidor_com.TypeDTO { ObjId = 2, Id = 3 }, User = new Navigation_View.services_911consumidor_com.UserDTO { Id = 3 }, TicketDetail = new Navigation_View.services_911consumidor_com.TicketDetailDTO[] { new Navigation_View.services_911consumidor_com.TicketDetailDTO { DetailDate = DateTime.Now, Subject = "Contacto Consumidor", Status = new Navigation_View.services_911consumidor_com.StatusDTO { OBJ_ID = 2, Id = 3 }, Message = string.Empty, Agent = new Navigation_View.services_911consumidor_com.UserDTO { UserId = string.Empty }, TIC_ID = 3 } }, Notes = ticket.Nota }, string_key); if (resultado != 0) { new AlertDialog.Builder(root.Context) .SetMessage("Muchas gracias por ponerte en contacto con 911 CONSUMIDOR, en breve recibirás una respuesta a tu caso.") .SetPositiveButton("OK", delegate { Console.WriteLine("OK"); }) .SetTitle("ATENCIÓN") .Show(); } } } catch (Exception ex) { new AlertDialog.Builder(root.Context) .SetMessage("Ocurrio un error: " + ex.Message.ToString()) .SetTitle("ATENCIÓN") .SetPositiveButton("OK", delegate { Console.WriteLine("OK"); }) .Show(); } finally { //txtApellido.Text=""; txtNombre.Text = ""; txtNota.Text = ""; txtCiudad.Text = ""; txtCorreo.Text = ""; txtTelefono.Text = ""; ddEstado.GetItemIdAtPosition(0); } }; return(root); }
public void OnClick(View v) { string tag = (string)v.Tag; string[] split = tag.Split(null); alertUspesno = new AlertDialog.Builder(this.activity).Create(); alertUspesno.SetTitle("Obavestenje!"); alertUspesno.SetMessage("Uspesno ste poslali korisniku: " + split[1] + " " + split[2] + " obrok(e)."); alertUspesno.SetButton("U redu", delegate(object sender, DialogClickEventArgs args) { alertUspesno.Dispose(); }); alertObrada = new AlertDialog.Builder(this.activity).Create(); alertObrada.SetTitle("Obrada!"); alertObrada.SetMessage("Molimo sacekajte!"); //alertObrada.Show(); var brojeviObroka = Api.Api.KorisnikovoStanjeObroka(MSettings.CurrentSession.LoggedUser.UserID); var inflater = LayoutInflater.From(this.activity); var view = inflater.Inflate(Resource.Layout.posaljiObrokDialog, null); obrociDialog = new AlertDialog.Builder(this.activity).Create(); obrociDialog.SetView(view); spinerDorucak = view.FindViewById <Spinner>(Resource.Id.spinerPosaljiDorucak); spinerRucak = view.FindViewById <Spinner>(Resource.Id.spinerPosaljiRucak); spinerVecera = view.FindViewById <Spinner>(Resource.Id.spinerPosaljiVeceru); List <string> nizDorucka = new List <string>(); for (int i = 0; i <= brojeviObroka.BrojDorucka; ++i) { nizDorucka.Add(i.ToString()); } spinerDorucak.Adapter = new ArrayAdapter <string>(this.activity, Android.Resource.Layout.SimpleSpinnerItem, nizDorucka); List <string> nizRuckova = new List <string>(); for (int i = 0; i <= brojeviObroka.BrojRuckova; ++i) { nizRuckova.Add(i.ToString()); } spinerRucak.Adapter = new ArrayAdapter <string>(this.activity, Android.Resource.Layout.SimpleSpinnerItem, nizRuckova); List <string> nizVecera = new List <string>(); for (int i = 0; i <= brojeviObroka.BrojVecera; ++i) { nizVecera.Add(i.ToString()); } spinerVecera.Adapter = new ArrayAdapter <string>(this.activity, Android.Resource.Layout.SimpleSpinnerItem, nizVecera); spinerDorucak.ItemSelected += delegate(object sender, AdapterView.ItemSelectedEventArgs args) { this.brojDorucka = (int)spinerDorucak.GetItemIdAtPosition(args.Position); }; spinerRucak.ItemSelected += delegate(object sender, AdapterView.ItemSelectedEventArgs args) { this.brojRucka = (int)spinerRucak.GetItemIdAtPosition(args.Position); }; spinerVecera.ItemSelected += delegate(object sender, AdapterView.ItemSelectedEventArgs args) { this.brojVecera = (int)spinerVecera.GetItemIdAtPosition(args.Position); }; obrociDialog.SetButton("Posalji", delegate(object sender, DialogClickEventArgs args) { obrociDialog.Dispose(); posalji.BrojDorucka = this.brojDorucka; posalji.BrojRuckova = this.brojRucka; posalji.BrojVecera = this.brojVecera; alertObrada.Show(); Thread novaNit = new Thread(() => FuncijaNoveNiti(split[0])); novaNit.Start(); }); obrociDialog.SetButton2("Odustani", delegate(object sender, DialogClickEventArgs args) { obrociDialog.Dispose(); }); obrociDialog.Show(); //Thread novaNit = new Thread(() => FuncijaNoveNiti(split[0])); //novaNit.Start(); }
void spinner_itemSelected(object sender, AdapterView.ItemSelectedEventArgs e) { Spinner spinner = (Spinner)sender; Console.WriteLine(spinner.GetItemIdAtPosition(e.Position)); }
private void btnConverter_Click(object sender, System.EventArgs e) { Spinner moeda1 = FindViewById <Spinner>(Resource.Id.moeda1); Spinner moeda2 = FindViewById <Spinner>(Resource.Id.moeda2); TextView hdnMoeda1 = FindViewById <TextView>(Resource.Id.hdnMoeda1); TextView hdnMoeda2 = FindViewById <TextView>(Resource.Id.hdnMoeda2); EditText txtQuantidade = FindViewById <EditText>(Resource.Id.txtQuantidade); TextView lblResultado = FindViewById <TextView>(Resource.Id.lblResultado); bool valid = true; if (txtQuantidade.Text.Length == 0) { Toast.MakeText(this, "Por favor informe a quantidade desejada para a conversão", ToastLength.Short).Show(); valid = false; } if (moeda1.GetItemIdAtPosition(moeda1.SelectedItemPosition) == 0) { Toast.MakeText(this, "Por favor selecione uma moeda de origem", ToastLength.Short).Show(); valid = false; } if (moeda2.GetItemIdAtPosition(moeda2.SelectedItemPosition) == 0) { Toast.MakeText(this, "Por favor selecione uma moeda de destino", ToastLength.Short).Show(); valid = false; } if (moeda1.GetItemIdAtPosition(moeda1.SelectedItemPosition) == moeda2.GetItemIdAtPosition(moeda2.SelectedItemPosition)) { Toast.MakeText(this, "A moeda de origem e destino devem ser diferentes", ToastLength.Short).Show(); valid = false; } if (valid) { try { Uri uri = new Uri(string.Format(UrlApi, hdnMoeda1.Text, hdnMoeda2.Text)); WebRequest request = WebRequest.Create(uri); request.ContentType = "application/json"; request.Method = "GET"; using (HttpWebResponse response = request.GetResponse() as HttpWebResponse) { if (response.StatusCode != HttpStatusCode.OK) { Toast.MakeText(this, "Erro na conexão com o serviço, tente novamente", ToastLength.Short); } using (StreamReader reader = new StreamReader(response.GetResponseStream())) { var content = reader.ReadToEnd(); if (string.IsNullOrWhiteSpace(content)) { Toast.MakeText(this, "Nenhum conteúdo encontrado", ToastLength.Short); } else { JObject jObject = JObject.Parse(content); decimal taxaCambio = (decimal)jObject["query"]["results"]["row"]["col1"]; lblResultado.Text = (Convert.ToDecimal(txtQuantidade.Text.Replace(".", ",")) * taxaCambio).ToString("0.##"); } } } } catch (Exception) { Toast.MakeText(this, "Ocorreu um erro, por favor tente novamente mais tarde", ToastLength.Short).Show(); } finally { //Desaloca os objetos da memória moeda1 = null; moeda2 = null; hdnMoeda1 = null; hdnMoeda2 = null; txtQuantidade = null; lblResultado = null; } } }