private void AddressButton_OnClick(object sender, EventArgs e) { _locationUpdatesRequested = !_locationUpdatesRequested; if (_locationUpdatesRequested) { _addressButton.Text = "Getting location updates. Tap to pause."; _locationsListViewAdapter.Insert($"{DateTime.Now.ToString("hh:mm:ss")} - Started getting location updates", 0); LocationServices.FusedLocationApi.RequestLocationUpdates(_googleApiClient, _locRequest, this); } else { _addressButton.Text = "Location updating paused. Tap to start."; _locationsListViewAdapter.Insert($"{DateTime.Now.ToString("hh:mm:ss")} - Paused getting location updates", 0); LocationServices.FusedLocationApi.RemoveLocationUpdates(_googleApiClient, this); } }
private void bSaveServer_Click(object sender, EventArgs e) { if (spinServers.SelectedItemId == -1) { return; } int index = (int)spinServers.SelectedItemId; GameServer gameServer = Settings.GameServers[index]; gameServer.Name = etServerNameSettings.Text; gameServer.SetServer(etServerAddressSettings.Text); serverList.Remove(serverList.GetItem(index)); serverList.Insert(Settings.GameServers[index].ToShortString(), index); serverList.NotifyDataSetChanged(); }
public void should_insert_item() { _adapter.Insert(1, "yo"); var array = _array.Instance.As <string[]>(); array.Length.ShouldEqual(3); array[1].ShouldEqual("yo"); }
public void repostaSat(string operacao) { string retornoOperaca = ""; switch (operacao) { case "ConsultarSat": retornoOperaca = satFunctions.ConsultarSat(SatUtils.GerarNumeroSessao); break; case "ConsultarStatusOperacional": retornoOperaca = satFunctions.ConsultarStatusOperacional(SatUtils.GerarNumeroSessao, txtCodAtivacao.Text); break; case "EnviarTesteFim": retornoOperaca = satFunctions.EnviarTesteFim(txtCodAtivacao.Text, SatUtils.GerarNumeroSessao); break; case "EnviarTesteVendas": retornoOperaca = satFunctions.EnviarTesteVendas(txtCodAtivacao.Text, SatUtils.GerarNumeroSessao); break; case "CancelarUltimaVenda": retornoOperaca = satFunctions.CancelarUltimaVenda(txtCodAtivacao.Text, ultimaChaveVenda, SatUtils.GerarNumeroSessao); break; case "ConsultarNumeroSessao": retornoOperaca = satFunctions.ConsultarNumeroSessao(txtCodAtivacao.Text, Integer.ParseInt(codigoSessao), SatUtils.GerarNumeroSessao); break; default: retornoOperaca = ""; break; } RetornoSat retornoSat = OperacaoSat.invocarOperacaoSat(operacao, retornoOperaca); /* * Está verificação(abaixo) tem como objetivo capturar a "Chave de Consulta" retornado na operação EnviarTesteVendas * O valor é armazenado em uma variavel global e quando o usuario abre a tela para cancelar venda, o campo (Chave de Cancelamento) já fica preenchido */ if (operacao == "EnviarTesteVendas") { //chave ultima venda GlobalValues.ultimaChaveVenda = retornoSat.ChaveConsulta; } GlobalValues.codigoAtivacao = txtCodAtivacao.Text; //* Está função [OperacaoSat.formataRetornoSat] recebe como parâmetro a operação realizada e um objeto do tipo RetornoSat //* Retorna uma String com os valores obtidos do retorno da Operação já formatados e prontos para serem exibidos na tela // Recomenda-se acessar a função e entender como ela funciona string retornoFormatado = OperacaoSat.formataRetornoSat(retornoSat); //SatUtils.DialogoRetorno(this, retornoFormatado); adapter.Insert(DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss\n") + retornoFormatado, 0); adapter.NotifyDataSetChanged(); }
public override bool OnKeyDown([GeneratedEnum] Keycode keyCode, KeyEvent e) { if (e.KeyCode == Keycode.F4 && SensorStart) { string result = DateTime.Now.ToString("dd/mm/yyyy HH:mm:ss") + " - Pessoa identificada à frente do equipamento.\n"; adapter.Insert(result, 0); adapter.NotifyDataSetChanged(); } return(base.OnKeyDown(keyCode, e)); }
/// <summary> /// Adds a new streamer. /// </summary> private void AddButtonClicked(object sender, EventArgs e) { var newStreamerText = FindViewById <EditText>(Resource.Id.newStreamerText); var streamerNames = preferences.GetString("streamer_names", "").Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries); ISharedPreferencesEditor editor = preferences.Edit(); Array.Resize(ref streamerNames, streamerNames.Length + 1); streamerNames[streamerNames.Length - 1] = newStreamerText.Text; editor.PutString("streamer_names", String.Join(";", streamerNames)); editor.Apply(); streamerAdapter.Insert(newStreamerText.Text, streamerAdapter.Count); streamerAdapter.NotifyDataSetChanged(); }
private void AddSearchFragment() { if (mSearchFragment != null) { return; } var ft = SupportFragmentManager.BeginTransaction(); var searchFragment = new LocationSearchFragment(); searchFragment.SetClickListener((object sender, RecyclerClickEventArgs e) => { var adapter = sender as LocationQueryAdapter; var v = (LocationQuery)e.View; if (!String.IsNullOrEmpty(adapter.Dataset[e.Position].LocationQuery)) { query_vm = adapter.Dataset[e.Position]; } else { query_vm = null; } if (String.IsNullOrWhiteSpace(query_vm.LocationQuery)) { // Stop since there is no valid query query_vm = null; return; } // Cancel other tasks mSearchFragment.CtsCancel(); ShowLoading(true); if (mSearchFragment.CtsCancelRequested()) { ShowLoading(false); query_vm = null; return; } // Check if location already exists if (Favorites.FirstOrDefault(l => l.query == query_vm.LocationQuery) is LocationData loc) { ShowLoading(false); ExitSearchUi(); // Set selection query_vm = null; locSpinner.SetSelection( locAdapter.GetPosition(new ComboBoxItem(loc.name, loc.query))); return; } if (mSearchFragment.CtsCancelRequested()) { ShowLoading(false); query_vm = null; return; } // We got our data so disable controls just in case adapter.Dataset.Clear(); adapter.NotifyDataSetChanged(); searchFragment.View.FindViewById <RecyclerView>(Resource.Id.recycler_view).Enabled = false; // Save data var item = new ComboBoxItem(query_vm.LocationName, query_vm.LocationQuery); var idx = locAdapter.Count - 1; locAdapter.Insert(item, idx); locSpinner.SetSelection(idx); locSummary.Text = item.Display; // Hide dialog ShowLoading(false); ExitSearchUi(); }); searchFragment.UserVisibleHint = false; ft.Add(Resource.Id.search_fragment_container, searchFragment); ft.CommitAllowingStateLoss(); }
public override bool OnOptionsItemSelected(IMenuItem item) { switch (item.ItemId) { case 0: { if (SelectedAccount != null) { SelectedAccount.Open(); } } return(true); case 1: { if (SelectedAccount != null) { SelectedAccount.Close(); } } return(true); case 3: { Account account = new Account(); account.ShowOnline = true; account.Force = true; account.AutoMessage = GetString(Resource.String.default_automessage); Settings.Accounts.Insert(0, account); array.Insert(account.ToString(), 0); array.NotifyDataSetChanged(); spinAccounts.SetSelection(0); ChangeAccount(); } return(true); case 4: { int index = (int)spinAccounts.SelectedItemId; array.Remove(array.GetItem(index)); Settings.Accounts.RemoveAt(index); } return(true); case 5: { ChangeAccount(); } return(true); case 6: { ServersSettingsActivity serversSettingsActivity = new ServersSettingsActivity(); Intent intent = new Intent(this, serversSettingsActivity.Class); StartActivity(intent); } return(true); default: return(base.OnOptionsItemSelected(item)); } }
public void OnUndo(object token) { mAdapter.Insert((string)token, _position); // Perform the undo }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.codBarras); // Create your application here run_scaner = false; list_resposta = FindViewById <ListView>(Resource.Id.lvConsulta); items = new List <string>(); adapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, items); list_resposta.Adapter = adapter; var btnStar = FindViewById <Button>(Resource.Id.btnStar); btnStar.Click += delegate { run_scaner = true; Byte[] leitura = new Byte[2048]; int[] tamanho = new int[1]; Task.Run(async() => { //inicia o scaner scaner = new Scaner(this); while (run_scaner) { // inicia o scan por um codigo de barras int result = scaner.ScanSingle(leitura, tamanho); if (result == 0 && run_scaner) { //converte o array de bytes para string string leitura_barcode = System.Text.Encoding.UTF8.GetString(leitura, 2, leitura.Length - 2); // necessario para atualizar a thread principal MainThread.BeginInvokeOnMainThread(() => { BeepSound(); adapter.Insert(leitura_barcode, 0); adapter.NotifyDataSetChanged(); }); } // reduz o processamento Thread.Sleep(1000); } }); }; var btnStop = FindViewById <Button>(Resource.Id.btnStop); btnStop.Click += delegate { run_scaner = false; }; var btnLigarLed = FindViewById <Button>(Resource.Id.btnLigarLed); btnLigarLed.Click += delegate { Barcode.LedUtil.SetRedLed(); }; var btnDesligarLed = FindViewById <Button>(Resource.Id.btnDesligarLed); btnDesligarLed.Click += delegate { Barcode.LedUtil.SetOffLed(); }; }