protected override void OnAppearing() { base.OnAppearing(); //PedidoModel pedido = new PedidoModel(); //GlobalVariables.GlobalPedido = pedido; //ClienteModel cliente = new ClienteModel(); //GlobalVariables.GlobalClientePedido = cliente; //Invoke on Main thread, or this won't work Device.BeginInvokeOnMainThread(() => { ECcodigo.Keyboard = Keyboard.Numeric; ECcodigo.Focus(); }); ECcodigo.Completed += (s, e) => { ECqtde.Keyboard = Keyboard.Numeric; codigo = ECcodigo.Text; ECqtde.Focus(); lblItemSelecionado.TextColor = Xamarin.Forms.Color.FromHex("#3B5998"); BuscaNomeProduto(); }; ECqtde.Completed += (s, e) => { ECcodigo.Keyboard = Keyboard.Numeric; quantidade = Convert.ToInt16(ECqtde.Text); InserirItem(s, e); ECcodigo.Text = ""; }; }
private void ECcodigo_TextChanged(object sender, TextChangedEventArgs e) { string last = ""; if (String.IsNullOrEmpty(e.NewTextValue) == false) { if (e.NewTextValue.Length > 2) { last = e.NewTextValue.Substring(e.NewTextValue.Length - 1, 1); } } if (last == "\n") { ECqtde.Focus(); } }