private void CargaArticuloVarios(object sender, ToggledEventArgs e) { //Añade un articulo varios por defecto cuando activa el switch try { RepositorySatApp database = new RepositorySatApp(); Articulos item = database.ObtenerArticuloVarios(); if (item != null) { if (switchVarios.IsToggled) { txtReferencia.Text = item.Referencia.ToString(); txtNombre.Text = item.Articulo; txtBase.Text = item.PVP.ToString(); txtCantidad.Text = "1"; txtTantoPorcierto.Text = item.IVA.ToString(); bolEsArticulo = true; btnListarArticulos.BackgroundColor = Color.FromHex("#0a4343"); btnListarServicios.BackgroundColor = Color.FromHex("#137F7F"); switchVarios.OnColor = Color.FromHex("#137F7F"); } else { txtReferencia.Text = ""; txtNombre.Text = ""; txtBase.Text = ""; txtCantidad.Text = ""; txtDto.Text = ""; txtTantoPorcierto.Text = ""; Busqueda.Text = ""; } } database.CerrarConexion(); } catch (Exception ex) { Application.Current.MainPage.DisplayAlert("Aviso", ex.Message, "OK"); } }