/// <summary> /// Observes the TextView's ImeAction so an action can be taken on keypress. /// </summary> public bool OnEditorAction(TextView v, ImeAction actionId, KeyEvent e) { //go edit action will login if (actionId == ImeAction.Go) { if (!string.IsNullOrEmpty(userName.Text) && !string.IsNullOrEmpty(password.Text)) { Login(); } else if (string.IsNullOrEmpty(userName.Text)) { userName.RequestFocus(); } else { password.RequestFocus(); } return(true); //next action will set focus to password edit text. } else if (actionId == ImeAction.Next) { if (!string.IsNullOrEmpty(userName.Text)) { password.RequestFocus(); } return(true); } return(false); }
private void TxtScanCase_KeyPress(object sender, View.KeyEventArgs e) { try { if (e.Event.Action == KeyEventActions.Down) { if (e.KeyCode == Keycode.Enter) { if (!string.IsNullOrEmpty(txtScanCase.Text)) { // SaveCase(txtScanCase.Text.Trim()); WriteFile(txtScanCase.Text.Trim()); txtScanCase.Text = ""; txtScanCase.RequestFocus(); } else { Toast.MakeText(this, "Scan case", ToastLength.Long).Show(); txtScanCase.RequestFocus(); } } else { e.Handled = false; } } } catch (Exception ex) { clsGLB.ShowMessage(ex.Message, this, MessageTitle.ERROR); } }
/// <summary> /// Method Name : SetEditTextFocus /// Author : Sanket Prajapati /// Creation Date : 2 Dec 2017 /// Purpose : set empty edittext focus /// Revision : /// </summary> public void SetEditTextFocus() { if (string.IsNullOrEmpty(txtVerficationDigit1.Text)) { txtVerficationDigit1.RequestFocus(); } else if (string.IsNullOrEmpty(txtVerficationDigit2.Text)) { txtVerficationDigit2.RequestFocus(); } else if (string.IsNullOrEmpty(txtVerficationDigit3.Text)) { txtVerficationDigit3.RequestFocus(); } else if (string.IsNullOrEmpty(txtVerficationDigit4.Text)) { txtVerficationDigit4.RequestFocus(); } else if (string.IsNullOrEmpty(txtVerficationDigit5.Text)) { txtVerficationDigit5.RequestFocus(); } else if (string.IsNullOrEmpty(txtVerficationDigit6.Text)) { txtVerficationDigit6.RequestFocus(); } }
public bool OnEditorAction(TextView v, ImeAction actionId, KeyEvent e) { //go edit action will login if (actionId == ImeAction.Go) { if (!string.IsNullOrEmpty(username.Text) && !string.IsNullOrEmpty(password.Text)) { ThreadPool.QueueUserWorkItem(o => Login()); } else if (string.IsNullOrEmpty(username.Text)) { username.RequestFocus(); } else { password.RequestFocus(); } return(true); } else if (actionId == ImeAction.Next) { if (!string.IsNullOrEmpty(username.Text)) { password.RequestFocus(); } return(true); } return(false); }
protected override void OnCreate(Android.OS.Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.xy_chart); mValue = FindViewById<EditText>(Resource.Id.xValue); mRenderer.ZoomButtonsVisible = true; mRenderer.StartAngle = 180; mRenderer.DisplayValues = true; mAdd = FindViewById<Button>(Resource.Id.add); mAdd.Enabled = true; mValue.Enabled = true; mAdd.Click += (e, s) => { double value = 0; try { value = Double.Parse(mValue.Text); } catch (Java.Lang.NumberFormatException) { mValue.RequestFocus(); return; } mValue.Text = ""; mValue.RequestFocus(); mSeries.Add("Series " + (mSeries.ItemCount + 1), value); SimpleSeriesRenderer renderer = new SimpleSeriesRenderer(); renderer.Color = COLORS[(mSeries.ItemCount - 1) % COLORS.Length]; mRenderer.AddSeriesRenderer(renderer); mChartView.Repaint(); }; }
private bool pAddPartsRepairs(string Data) { var _SP = new SP(Values.gDatos, "pAddPartsRepairs"); try { _SP.AddParameterValue("RepairCode", cRepairCode); _SP.AddParameterValue("UnitNumber", cUnitNumber); _SP.AddParameterValue("Reading", Data); _SP.Execute(); } catch (Exception ex) { Toast.MakeText(Activity, "Error: " + ex.Message, ToastLength.Long).Show(); cDataBox.Text = ""; cDataBox.RequestFocus(); return(false); } if (_SP.LastMsg != "OK") { Toast.MakeText(Activity, "Error: " + _SP.LastMsg, ToastLength.Long).Show(); cDataBox.Text = ""; cDataBox.RequestFocus(); return(false); } cListAdapter.NotifyDataSetChanged(); cList.InvalidateViews(); cDataBox.Text = ""; cDataBox.RequestFocus(); return(true); }
protected override void OnCreate(Android.OS.Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.xy_chart); mValue = FindViewById <EditText>(Resource.Id.xValue); mRenderer.ZoomButtonsVisible = true; mRenderer.StartAngle = 180; mRenderer.DisplayValues = true; mAdd = FindViewById <Button>(Resource.Id.add); mAdd.Enabled = true; mValue.Enabled = true; mAdd.Click += (e, s) => { double value = 0; try { value = Double.Parse(mValue.Text); } catch (Java.Lang.NumberFormatException) { mValue.RequestFocus(); return; } mValue.Text = ""; mValue.RequestFocus(); mSeries.Add("Series " + (mSeries.ItemCount + 1), value); SimpleSeriesRenderer renderer = new SimpleSeriesRenderer(); renderer.Color = COLORS[(mSeries.ItemCount - 1) % COLORS.Length]; mRenderer.AddSeriesRenderer(renderer); mChartView.Repaint(); }; }
private bool ValidateData() { Android.Net.ConnectivityManager cm = (Android.Net.ConnectivityManager) this.GetSystemService(Context.ConnectivityService); if (cm.ActiveNetworkInfo == null) { Toast.MakeText(this, "Network error. Try again later.", ToastLength.Long).Show(); return(false); } else if (etUsername.Text.ToString().Trim().Equals("")) { etUsername.SetError("Username is required!", null); etUsername.RequestFocus(); return(false); } else if (etPassword.Text.ToString().Trim().Equals("")) { etPassword.SetError("Password is required!", null); etPassword.RequestFocus(); return(false); } else if (!ValidatePassword(etPassword.Text.ToString().Trim())) { etPassword.SetError("Password must be alphanumeric and at least 6 character!", null); etPassword.RequestFocus(); return(false); } else if (etConPassword.Text.ToString().Trim().Equals("")) { etConPassword.SetError("Confirm password is required!", null); etConPassword.RequestFocus(); return(false); } else if (!etPassword.Text.ToString().Equals(etConPassword.Text.ToString())) { etConPassword.SetError("Password is not same!", null); etConPassword.RequestFocus(); return(false); } else if (etPhone.Text.ToString().Trim().Equals("")) { etPhone.SetError("Phone is required!", null); etPhone.RequestFocus(); return(false); } else if (spnGender.SelectedItem.ToString().Equals("--Select Gender--")) { Toast.MakeText(this, "Select your gender.", ToastLength.Long).Show(); return(false); } else if (etUsername.Text.ToString().Trim().Contains(" ")) { etUsername.SetError("Username contain space!", null); etUsername.RequestFocus(); return(false); } else { return(true); } }
private async void addAccount() { //do checks to make sure data is entered into form before saving if (name.Text != "") { if (accountType.SelectedItem.ToString() != "") { if (startBalance.Text != "") { await MainActivity.db.addAccount(name.Text, note.Text, accountType.SelectedItem.ToString(), Convert.ToDecimal(startBalance.Text), DateTime.Now, "Initial Balance", "", ""); MainActivity.accountAdapter.NotifyDataSetChanged(); //set selected item to the last item in the list MainActivity.mLayoutManager.ScrollToPosition(MainActivity.accounts.Count - 1); this.Finish(); //close view when finished entering transaction } else { startBalance.RequestFocus(); Toast.MakeText(this, "Staring Balance cannot be null/empty", ToastLength.Short).Show(); } } else { accountType.RequestFocus(); Toast.MakeText(this, "Type cannot be null/empty", ToastLength.Short).Show(); } } else { name.RequestFocus(); Toast.MakeText(this, "Name cannot be null/empty", ToastLength.Short).Show(); } }
void EditItem(string cnno, int id) { using (var db = new SQLite.SQLiteConnection(pathToDatabase)) { var list = db.Table <CNNoteDtls>().Where(x => x.cnno == cnno && x.ID == id).ToList <CNNoteDtls>(); if (list.Count > 0) { txtqty.Text = list [0].qty.ToString(); txtprice.Text = list [0].price.ToString("n2"); int pos1 = 0; if (list [0].description.Length > 40) { pos1 = dAdapterItem.GetPosition(list [0].icode + " | " + list [0].description.Substring(0, 40) + "..."); } else { pos1 = dAdapterItem.GetPosition(list [0].icode + " | " + list [0].description); } spinItem.SetSelection(pos1); spinItem.Enabled = false; butFindItem.Enabled = false; IsEdit = true; IDdtls = list [0].ID; txtInvMode.Text = "EDIT"; txtqty.RequestFocus(); txtqty.SelectAll(); } } }
private void ScanEditText_KeyPress(object sender, View.KeyEventArgs e) { e.Handled = false; scan = string.Empty; if (e.KeyCode == Keycode.Enter && e.Event.Action == KeyEventActions.Up) { e.Handled = true; if (scanEditText.Text != string.Empty) { scan = scanEditText.Text.ToUpper(); if (TransportmittelExists(scan)) { spinner.SetSelection(spinnerIndex); hintTextView.Text = GetString(Resource.String.pressForward); scanEditText.Text = ""; scanEditText.RequestFocus(); Forward(); } else { scanEditText.Text = ""; scanEditText.RequestFocus(); } } else { Utility.ShowErrorMessage(this, GetString(Resource.String.nothingScanned)); } } }
private void BtnCEPButton_ClickAsync(object sender, EventArgs e) { bool ping = valida.TesteConexao(); if (!ping) { Toast.MakeText(this, "Sem Conexão com a internet. Tente mais tarde!!", ToastLength.Short).Show(); txtCEP.RequestFocus(); return; } if (string.IsNullOrEmpty(txtCEP.Text)) { Toast.MakeText(this, "Digite um CEP para pesquisar!!", ToastLength.Short).Show(); txtCEP.RequestFocus(); return; } else { using (br.com.correios.apps.AtendeClienteService ws = new br.com.correios.apps.AtendeClienteService()) { try { br.com.correios.apps.enderecoERP dados = ws.consultaCEP(txtCEP.Text); txtLocal.Text = dados.end + ", " + dados.bairro + ", " + dados.cidade + ", " + dados.uf; } catch { txtLocal.Text = ""; Toast.MakeText(this, "CEP não encontrado. Por favor verifique!!", ToastLength.Short).Show(); } } } }
public override bool OnKeyUp([GeneratedEnum] Keycode keyCode, KeyEvent e) { switch (keyCode) { case Keycode.Del: if (txtClaveVozSexto.Text.Length == 0) { txtClaveVozQuinto.RequestFocus(); } if (txtClaveVozQuinto.Text.Length == 0) { txtClaveVozCuarto.RequestFocus(); } if (txtClaveVozCuarto.Text.Length == 0) { txtClaveVozTercero.RequestFocus(); } if (txtClaveVozTercero.Text.Length == 0) { txtClaveVozSegundo.RequestFocus(); } if (txtClaveVozSegundo.Text.Length == 0) { txtClaveVoz.RequestFocus(); } return(true); default: return(base.OnKeyUp(keyCode, e)); } }
public void SetFocus() { if (editText == null) { return; } editText.RequestFocus(); }
private void Login() { if (string.IsNullOrEmpty(edtUsuario.Text.ToString().Trim())) { Toast.MakeText(Application.Context, "Por favor, insira um usuário para acessar o sistema.", ToastLength.Long).Show(); edtUsuario.Text = ""; edtUsuario.RequestFocus(); return; } if (string.IsNullOrEmpty(edtSenha.Text.ToString().Trim())) { Toast.MakeText(Application.Context, "Por favor, insira a senha para acessar o sistema.", ToastLength.Long).Show(); edtUsuario.Text = ""; edtSenha.RequestFocus(); return; } MySqlCommand cmdVerificar; MySqlDataReader reader; con.AbreConexao(); cmdVerificar = new MySqlCommand("SELECT * FROM usuarios WHERE usuario = @usuario and senha = @senha", con.conex); cmdVerificar.Parameters.AddWithValue("@usuario", edtUsuario.Text); cmdVerificar.Parameters.AddWithValue("@senha", edtSenha.Text); reader = cmdVerificar.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { var.nomeUsuario = reader["nome"].ToString(); var.cargoUsuario = reader["cargo"].ToString(); } //INTENT PARA PASSAR PARÂMETROS ENTRE ACTIVITIES var tela = new Intent(this, typeof(Menu)); tela.PutExtra("nome", var.nomeUsuario); tela.PutExtra("cargo", var.cargoUsuario); StartActivity(tela); Limpar(); } else { Toast.MakeText(Application.Context, "Dados incorretos.", ToastLength.Long).Show(); Limpar(); } con.FechaConexao(); }
void SetViews(string _numpadType) { //change_qty, change_price, change_discount mEtNumpadValue = FindViewById <EditText>(Resource.Id.etNumpadValue); mEtNumpadValue.InputType = Android.Text.InputTypes.Null; mEtNumpadValue.SetSelection(mEtNumpadValue.Text.Length); mEtOldNumpadValue = FindViewById <EditText>(Resource.Id.etOldQty); mEtOldNumpadValue.InputType = Android.Text.InputTypes.Null; mTxtRemoveItem = FindViewById <TextView>(Resource.Id.txtRemoveItem); mGridNumpad = FindViewById <GridLayout>(Resource.Id.glNumPad); mTxtOldQty = FindViewById <TextView>(Resource.Id.txtOldQty); mTxtNewQty = FindViewById <TextView>(Resource.Id.txtNewQty); mTxtOK = FindViewById <TextView>(Resource.Id.txtNumpadCheck); if (_numpadType == "change_qty") { mTxtOldQty.Text = "Current quantity"; mTxtNewQty.Text = "New quantity"; mTxtRemoveItem.Text = "Remove item"; mTxtRemoveItem.SetTextColor(ColorResourceToColorInt(Resource.Color.colorRed, this)); mTxtRemoveItem.Click += MRemoveItem_Click; mEtNumpadValue.SetFilters(new IInputFilter[] { new InputFilterLengthFilter(changeQtyMaxLength) });//set max length mEtNumpadValue.RequestFocus(); } else if (_numpadType == "change_price") { mTxtOldQty.Text = "Current item price"; mTxtNewQty.Text = "Edit item price"; mTxtRemoveItem.Text = "The price of this product will be changed for this sale only"; mTxtRemoveItem.SetTextColor(ColorResourceToColorInt(Resource.Color.colorBlurred, this)); mTxtRemoveItem.Enabled = false; mEtNumpadValue.SetFilters(new IInputFilter[] { new InputFilterLengthFilter(changePriceMaxLength) });//set max length mEtNumpadValue.RequestFocus(); } else if (_numpadType == "change_discount") { mTxtOldQty.Text = "Original Subtotal"; mTxtNewQty.Text = "Edit discount amount"; mTxtRemoveItem.Text = ""; mTxtRemoveItem.Enabled = false; mEtNumpadValue.SetFilters(new IInputFilter[] { new InputFilterLengthFilter(changePriceMaxLength) });//set max length mEtNumpadValue.RequestFocus(); } else { //data not available error } }
public void KeepFocusAtTheEndOfField_WhenTextChangedWithFocus_WhenRefocused_MovesCursorToTheEndOfField(string str) { EditText editText = new EditText(MainActivity.Current); editText.RequestFocus(); editText.Text = str; editText.ClearFocus(); editText.RequestFocus(); Assert.Equal(editText.SelectionEnd, editText.SelectionStart); Assert.Equal(editText.SelectionStart, str.Length); }
private async void addTransaction() { //do checks to make sure data is entered into form before saving if (title.Text != "") { if (amount.Text != "") { if (date.Text != "") { if (category.SelectedItem.ToString() != "") { if (type_toaccount.SelectedItem.ToString() != "") { await MainActivity.db.addTransaction(accountPK, Convert.ToDateTime(date.Text.ToString()), title.Text, Convert.ToDecimal(amount.Text), category.SelectedItem.ToString(), type_toaccount.SelectedItem.ToString(), notes.Text); //Transactions.transactionAdapter.NotifyDataSetChanged(); //set selected item to the last item in the list Transactions.mLayoutManager.ScrollToPosition(Transactions.transactions.Count - 1); this.Finish(); //close view when finished entering transaction } else { type_toaccount.RequestFocus(); Toast.MakeText(this, "Type cannot be null/empty", ToastLength.Short).Show(); } } else { category.RequestFocus(); Toast.MakeText(this, "Category cannot be null/empty", ToastLength.Short).Show(); } } else { date.RequestFocus(); Toast.MakeText(this, "Date cannot be null/empty", ToastLength.Short).Show(); } } else { amount.RequestFocus(); Toast.MakeText(this, "Amount cannot be null/empty", ToastLength.Short).Show(); } } else { title.RequestFocus(); Toast.MakeText(this, "Item cannot be null/empty", ToastLength.Short).Show(); } }
private async void OnResetPassword(object sender, EventArgs e) { string confirmCode = tbConfirmCode.TrimInput(); if (confirmCode.Length < 6) { // Enter cofirm code tbConfirmCode.RequestFocus(); tbConfirmCode.SelectAll(); // ShowMessage("Please enter a valid reset code"); return; } string passwordNew = tbPwd.Text; string passwordConfirm = tbPwdConfirm.Text; if (passwordNew.Length < 6) { tbPwd.RequestFocus(); tbPwd.SelectAll(); return; } if (passwordConfirm != passwordNew) { tbPwd.RequestFocus(); tbPwd.SelectAll(); return; } // Validate code using (Busy()) { var proxy = ProxyFactory.GetProxyInstace(); var response = await proxy.ExecuteAsync(API.Endpoints.AccountEndpoints.ResetPassword(confirmCode, resetBearerToken, passwordNew)); if (response.Successful) { SetResult(Result.Ok); Finish(); } else { ShowMessage(response.GetErrorDescription()); } } }
private void TxtRfid_KeyPress(object sender, View.KeyEventArgs e) { try { if (e.Event.Action == KeyEventActions.Down) { if (e.KeyCode == Keycode.Enter) { txtMsg.Text = ""; if (string.IsNullOrEmpty(txtImei.Text.Trim())) { clsGLB.ShowMessage("Scan IMEI Barcode", this, MessageTitle.INFORMATION); txtImei.RequestFocus(); return; } if (string.IsNullOrEmpty(txtRfid.Text.Trim())) { clsGLB.ShowMessage("Scan Rfid Barcode", this, MessageTitle.INFORMATION); txtRfid.RequestFocus(); return; } string ReturnMsg = mappingDb.MapRfid(new Mapping { IMEI = txtImei.Text.Trim(), RfidBarcode = txtRfid.Text.Trim() }); if (ReturnMsg.Split('~')[0] == "Y") { txtImei.Text = ""; txtRfid.Text = ""; txtImei.RequestFocus(); txtMsg.Text = "Mapped successfully"; } else { clsGLB.ShowMessage(ReturnMsg.Split('~')[1], this, MessageTitle.INFORMATION); txtRfid.Text = ""; txtRfid.RequestFocus(); } } else { e.Handled = false; } } } catch (Exception ex) { clsGLB.ShowMessage(ex.Message, this, MessageTitle.ERROR); } }
void TxtUsername_TextChanged(object sender, TextChangedEventArgs e) { if (txtUsername.RequestFocus() && validarRut(txtUsername.Text)) { lineTxtUsername.BackgroundTintList = Android.Support.V4.Content.ContextCompat.GetColorStateList(ApplicationContext, Resource.Color.green); } else if (txtUsername.RequestFocus() && string.IsNullOrEmpty(txtUsername.Text)) { lineTxtUsername.BackgroundTintList = Android.Support.V4.Content.ContextCompat.GetColorStateList(ApplicationContext, Resource.Color.security_line_sin_validacion); } else { lineTxtUsername.BackgroundTintList = Android.Support.V4.Content.ContextCompat.GetColorStateList(ApplicationContext, Resource.Color.red); } }
private void FocusOnNextEmptyTextFields() { Activity.RunOnUiThread(() => { try { if (string.IsNullOrWhiteSpace(_recipient.Text)) { _recipient.RequestFocus(); } else if (string.IsNullOrWhiteSpace(_subject.Text)) { _subject.RequestFocus(); } else if (string.IsNullOrWhiteSpace(_body.Text)) { _body.RequestFocus(); } else { _signature.RequestFocus(); } } catch (Exception e) { MyLogger.Error("Error encountered finding the next text field to focus on." + e.ToString()); } }); }
public static void OnTouchEvent(EditText sender, MotionEvent?e) { if (e != null && e.Action == MotionEventActions.Up && !sender.IsFocused) { sender.RequestFocus(); } }
protected override async void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Login); GlobalServices.XjtuSite.Account.IsLoggedInChanged += Account_IsLoggedInChanged; if (!await UpdateAccountStatus()) { userNameView = FindViewById<EditText>(Resource.Id.accountNameEdit); passwordView = FindViewById<EditText>(Resource.Id.passwordEdit); savePasswordCheckBox = FindViewById<CheckBox>(Resource.Id.savePasswordCheckbox); loginButton = FindViewById<Button>(Resource.Id.loginButton); //ÔØÈëÉèÖᣠusing (var pref = GetPreferences(FileCreationMode.Private)) { userNameView.Text = pref.GetString("userName", ""); passwordView.Text = pref.GetString("password", ""); savePasswordCheckBox.Checked = pref.GetBoolean("savePassword", false); } if (!string.IsNullOrWhiteSpace(userNameView.Text)) passwordView.RequestFocus(); //ÕìÌýʼþ¡£ EventHandler<TextChangedEventArgs> userNamePasswordChanged = (_, e) => { loginButton.Enabled = !string.IsNullOrWhiteSpace(userNameView.Text) && !string.IsNullOrEmpty(passwordView.Text); }; userNameView.TextChanged += userNamePasswordChanged; passwordView.TextChanged += userNamePasswordChanged; savePasswordCheckBox.CheckedChange += SavePasswordCheckBox_CheckedChange; loginButton.Click += LoginButton_Click; } }
public void Binding_TwoWayFromEditTextToEditTextWithObserveEvent_BindingGetsUpdated() { var control1 = new EditText(Application.Context); var control2 = new EditText(Application.Context); _binding = new Binding <string, string>( control1, () => control1.Text, control2, () => control2.Text, BindingMode.TwoWay) .ObserveSourceEvent(UpdateTriggerMode.LostFocus) .ObserveTargetEvent(UpdateTriggerMode.LostFocus); Assert.AreEqual(string.Empty, control1.Text); Assert.AreEqual(string.Empty, control2.Text); var value = DateTime.Now.Ticks.ToString(); control1.RequestFocus(); control1.Text = value; Assert.AreEqual(value, control1.Text); Assert.AreEqual(string.Empty, control2.Text); control1.ClearFocus(); Assert.AreEqual(control1.Text, control2.Text); var newValue = value + "Suffix"; control2.RequestFocus(); control2.Text = newValue; Assert.AreEqual(newValue, control2.Text); Assert.AreEqual(value, control1.Text); control2.ClearFocus(); Assert.AreEqual(control2.Text, control1.Text); }
public void Binding_OneWayFromEditTextToViewModelWithObserveEvent_BindingGetsUpdated() { var vm = new TestViewModel { Model = new TestModel() }; var control1 = new EditText(Application.Context); _binding = new Binding <string, string>( control1, () => control1.Text, vm, () => vm.Model.MyProperty) .ObserveSourceEvent(UpdateTriggerMode.LostFocus); Assert.AreEqual(string.Empty, control1.Text); Assert.AreEqual(string.Empty, vm.Model.MyProperty); var value = DateTime.Now.Ticks.ToString(); control1.RequestFocus(); control1.Text = value; Assert.AreEqual(value, control1.Text); Assert.AreEqual(string.Empty, vm.Model.MyProperty); control1.ClearFocus(); Assert.AreEqual(control1.Text, vm.Model.MyProperty); }
public void Binding_TwoWayFromEditTextToCheckBoxWithObserveEvent_BindingGetsUpdated() { var control1 = new EditText(Application.Context); var control2 = new CheckBox(Application.Context); _binding = new Binding <string, bool>( control1, () => control1.Text, control2, () => control2.Checked, BindingMode.TwoWay) .ObserveSourceEvent(UpdateTriggerMode.LostFocus) .ObserveTargetEvent(); // LostFocus doesn't work programatically with CheckBoxes Assert.AreEqual(string.Empty, control1.Text); Assert.IsFalse(control2.Checked); var value = "True"; control1.RequestFocus(); control1.Text = value; Assert.AreEqual(value, control1.Text); Assert.IsFalse(control2.Checked); control1.ClearFocus(); Assert.IsTrue(control2.Checked); control2.Checked = false; Assert.IsFalse(control2.Checked); Assert.AreEqual("False", control1.Text); }
public void Binding_TwoWayFromViewModelToEditTextWithObserveEvent_BindingGetsUpdated() { var vm = new TestViewModel { Model = new TestModel() }; var control1 = new EditText(Application.Context); _binding = new Binding <string, string>( vm, () => vm.Model.MyProperty, control1, () => control1.Text, BindingMode.TwoWay) .ObserveTargetEvent(UpdateTriggerMode.LostFocus); Assert.AreEqual(null, vm.Model.MyProperty); Assert.AreEqual(string.Empty, control1.Text); var value = DateTime.Now.Ticks.ToString(); vm.Model.MyProperty = value; Assert.AreEqual(value, vm.Model.MyProperty); Assert.AreEqual(vm.Model.MyProperty, control1.Text); var newValue = value + "Suffix"; control1.RequestFocus(); control1.Text = newValue; Assert.AreEqual(newValue, control1.Text); Assert.AreEqual(value, vm.Model.MyProperty); control1.ClearFocus(); Assert.AreEqual(newValue, vm.Model.MyProperty); }
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); }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); if (!((GlobalvarsApp)this.Application).ISLOGON) { Finish (); } SetTitle (Resource.String.title_payment); SetContentView (Resource.Layout.Payment); string samt = Intent.GetStringExtra ("amount") ?? "0"; amount = Convert.ToDouble (samt); txtAmt = FindViewById<EditText> (Resource.Id.payamt); txtRound = FindViewById<EditText> (Resource.Id.payround); txtTotal = FindViewById<EditText> (Resource.Id.paytotal); txtCash = FindViewById<EditText> (Resource.Id.paycash); txtChange = FindViewById<EditText> (Resource.Id.paychange); txtAmt.Text = amount.ToString ("n2"); double roundVal=0; double ttlAmt = Utility.AdjustToNear (amount, ref roundVal); txtRound.Text = roundVal.ToString ("n2"); txtTotal.Text = ttlAmt.ToString ("n2"); txtCash.EditorAction += HandleEditorAction; txtCash.AfterTextChanged += TxtCash_AfterTextChanged; Button butInvBack= FindViewById<Button> (Resource.Id.payok); butInvBack.Click += (object sender, EventArgs e) => { base.OnBackPressed (); }; txtCash.RequestFocus (); }
protected override void OnCreate(Bundle savedInstanceState) { try { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.activity_main); Button btnServerSetting = FindViewById <Button>(Resource.Id.btnServerSetting); btnServerSetting.Click += BtnServerSetting_Click; txtScanCase = FindViewById <EditText>(Resource.Id.txtScanCase); txtScanCase.KeyPress += TxtScanCase_KeyPress; txtScanCount = FindViewById <TextView>(Resource.Id.txtScanCount); listViewScanCase = FindViewById <ListView>(Resource.Id.listViewScanCase); _listScanCase = new List <ScanCaseModel>(); ItemAdapter = new CaseItemAdapter(this, _listScanCase); listViewScanCase.Adapter = ItemAdapter; if (ReadSettingFile() == false) { OpenActivity(typeof(SettingActivity)); } ReadCaseFile(); txtScanCase.RequestFocus(); } catch (Exception ex) { clsGLB.ShowMessage(ex.Message, this, MessageTitle.ERROR); } }
public void Binding_TwoWayFromCheckBoxToEditTextWithUpdateTrigger_BindingGetsUpdated() { var control1 = new EditText(Application.Context); var control2 = new CheckBox(Application.Context); _binding = new Binding <bool, string>( control2, () => control2.Checked, control1, () => control1.Text, BindingMode.TwoWay) .UpdateSourceTrigger() // LostFocus doesn't work programatically with CheckBoxes .ObserveTargetEvent(UpdateTriggerMode.LostFocus); Assert.AreEqual("False", control1.Text); Assert.IsFalse(control2.Checked); control2.Checked = true; Assert.IsTrue(control2.Checked); Assert.AreEqual("True", control1.Text); var value = "False"; control1.RequestFocus(); control1.Text = value; Assert.AreEqual(value, control1.Text); Assert.IsTrue(control2.Checked); control1.ClearFocus(); Assert.IsFalse(control2.Checked); }
public void OnSelectCountry(Country country) { country_code = country.Code; countryFlagImg.SetBackgroundResource(country.Flag); CCTV.Text = country.DialCode; UserPhoneText.RequestFocus(); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { base.OnCreateView (inflater, container, savedInstanceState); var view = inflater.Inflate (Resource.Layout.QuoteLayout, container, false); quoteLocation = view.FindViewById<EditText> (Resource.Id.quoteLocation); quoteModel = view.FindViewById<EditText> (Resource.Id.quoteModel); quotePrice = view.FindViewById<EditText> (Resource.Id.quotePrice); quotePosition = view.FindViewById<EditText> (Resource.Id.quotePosition); quoteButton = view.FindViewById<Button> (Resource.Id.quoteButton); quoteLocation.Text = location; quoteModel.Text = model; quotePrice.RequestFocus (); quoteButton.Click += delegate { double price; bool isDouble = Double.TryParse(quotePrice.Text, out price); if(isDouble) { if (price > minPrice) { if (price < minPrice * 1.6) { position = quotePosition.Text; if (position.Length < 15) { Thread thread = new Thread(() => { Database.quote(location, model, quotePrice.Text, position); }); thread.Start(); } else { Thread thread = new Thread(() => { Database.quote(location, model, quotePrice.Text, ""); }); thread.Start(); } } quotePrice.SetBackgroundColor(Android.Graphics.Color.Lime); Toast.MakeText(Application.Context, "成功報價!更新中...", ToastLength.Short).Show(); var activity = (MainActivity)Activity; Thread thread2 = new Thread(() => { activity.FragmentManager.PopBackStack(); Thread.Sleep(1000); activity.updateGUI(Database.select(location)); activity.RunOnUiThread(() => { Toast.MakeText(Application.Context, "更新成功!", ToastLength.Short).Show(); }); }); thread2.Start(); } else { quotePrice.SetBackgroundColor(Android.Graphics.Color.Red); quotePrice.Error = "有幾多我同你買幾多!"; } } else { quotePrice.SetBackgroundColor(Android.Graphics.Color.Red); quotePrice.Error = "Enter number!"; } }; return view; }
private void SetViews() { _email = Activity.FindViewById<EditText>(Resource.Id.email); _email.RequestFocus(); _confirmEmail = Activity.FindViewById<EditText>(Resource.Id.confirmEmail); _userName = Activity.FindViewById<EditText>(Resource.Id.userName); _password = Activity.FindViewById<EditText>(Resource.Id.password); _confirmPassword = Activity.FindViewById<EditText>(Resource.Id.confirmPassword); _submit = Activity.FindViewById<Button>(Resource.Id.submit); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { try { _view = inflater.Inflate(Resource.Layout.InputDialog, container); _editTextCvvValue = (EditText)_view.FindViewById(Resource.Id.editTextCvvValue); _textViewMessage = (TextView)_view.FindViewById(Resource.Id.textViewMessage); _buttonOk = _view.FindViewById<Button>(Resource.Id.buttonOk); _buttonOk.Click += ButtonOkClick; string title = this.Arguments.GetString("title", "PI"); string message = this.Arguments.GetString("message", "Input the value"); this.Dialog.SetTitle(title); _textViewMessage.Text = message; _editTextCvvValue.RequestFocus(); this.Dialog.Window.SetSoftInputMode(SoftInput.StateVisible); } catch (Exception ex) { Helpers.Alert(_context, "PI - CvvInputFragment - OnCreateView", ex.Message, false); } return _view; }
protected override void OnCreate (Bundle savedInstanceState) { base.OnCreate (savedInstanceState); SetContentView(Resource.Layout.main); _itemListView = FindViewById<ListView>(Resource.Id.itemListView); _itemListView.OnItemClickListener = this; _itemListView.OnItemLongClickListener = this; _addItemEditText = FindViewById<EditText>(Resource.Id.newItemText); _addItemEditText.SetOnKeyListener(this); _addItemEditText.RequestFocus(); InitItemListAdapter(); _taskMgr.TasksUpdated += (sender, e) => { _listAdapter.Clear(); _listAdapter.AddAll((ICollection)e); _listAdapter.NotifyDataSetChanged(); }; //Step 11A - Start sync }
public void Binding_TwoWayFromViewModelToEditTextWithObserveEvent_BindingGetsUpdated() { var vm = new TestViewModel { Model = new TestModel() }; var control1 = new EditText(Application.Context); var binding = new Binding<string, string>( vm, () => vm.Model.MyProperty, control1, () => control1.Text, BindingMode.TwoWay) .ObserveTargetEvent(UpdateTriggerMode.LostFocus); Assert.AreEqual(null, vm.Model.MyProperty); Assert.AreEqual(string.Empty, control1.Text); var value = DateTime.Now.Ticks.ToString(); vm.Model.MyProperty = value; Assert.AreEqual(value, vm.Model.MyProperty); Assert.AreEqual(vm.Model.MyProperty, control1.Text); var newValue = value + "Suffix"; control1.RequestFocus(); control1.Text = newValue; Assert.AreEqual(newValue, control1.Text); Assert.AreEqual(value, vm.Model.MyProperty); control1.ClearFocus(); Assert.AreEqual(newValue, vm.Model.MyProperty); }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); SetContentView (Resource.Layout.LoginActivitys); ColorDrawable colorDrawable = new ColorDrawable (Color.ParseColor (Helpers.ColorHeader)); ActionBar.SetBackgroundDrawable (colorDrawable); BtnFacebook = FindViewById<Button> (Resource.Id.BtnFacebook); BtnRegister = FindViewById<Button> (Resource.Id.BtnRegister); BtnLogin = FindViewById<Button> (Resource.Id.BtnLogin); TxtLogin = FindViewById<EditText> (Resource.Id.TxtLogin); TxtPwd = FindViewById<EditText> (Resource.Id.TxtPwd); BtnFacebook.Visibility = ViewStates.Gone; #if DEBUG TxtLogin.Text="*****@*****.**"; TxtPwd.Text="123456"; #endif BtnRegister.Click += (sender, e) => { var datosActivity = new Intent (this, typeof(RegisterActivity)); StartActivity (datosActivity); }; BtnFacebook.Click += (sender, e) => { var webAuth = new Intent (this, typeof(FBWebViewAuthActivity)); webAuth.PutExtra ("AppId", AppId); webAuth.PutExtra ("ExtendedPermissions", ExtendedPermissions); StartActivityForResult (webAuth, 0); }; BtnLogin.Click += async (sender, e) => { if (TxtLogin.Text == string.Empty) { TxtLogin.SetError ("Digite su Email", null); TxtLogin.RequestFocus (); return; } if (TxtPwd.Text == string.Empty) { TxtPwd.SetError ("Digite su Contraseña", null); TxtPwd.RequestFocus (); return; } _ProgressDialog = ProgressDialog.Show (this, "Por favor espera...", "Procesando info...", true); ResultMsg<Users> user= await _Bussines.Login (TxtLogin.Text, TxtPwd.Text); _ProgressDialog.Dismiss(); if(user!=null && user.Dato!=null){ this.SetUserDatos(user.Dato); var datosActivity = new Intent (this, typeof(GridActivity)); StartActivity (datosActivity); Finish(); }else{ Toast.MakeText (ApplicationContext, "Error: Su Usuario o Contraseña es erradas", ToastLength.Long).Show (); } }; try { Account[] accounts = AccountManager.Get (this).GetAccountsByType ("com.google"); foreach (Account account in accounts) { if (!string.IsNullOrEmpty (account.Name)) { TxtLogin.Text = account.Name; return; } //accountsList.add(item); } } catch (Exception) { return; } }
public void Binding_OneWayFromEditTextToEditTextWithUpdateTrigger_BindingGetsUpdated() { var control1 = new EditText(Application.Context); var control2 = new EditText(Application.Context); _binding = new Binding<string, string>( control1, () => control1.Text, control2, () => control2.Text) .UpdateSourceTrigger(UpdateTriggerMode.LostFocus); Assert.AreEqual(string.Empty, control1.Text); Assert.AreEqual(string.Empty, control2.Text); var value = DateTime.Now.Ticks.ToString(); control1.RequestFocus(); control1.Text = value; Assert.AreEqual(value, control1.Text); Assert.AreEqual(string.Empty, control2.Text); control1.ClearFocus(); Assert.AreEqual(control1.Text, control2.Text); }
public void Binding_OneWayFromEditTextToViewModelWithObserveEvent_BindingGetsUpdated() { var vm = new TestViewModel { Model = new TestModel() }; var control1 = new EditText(Application.Context); var binding = new Binding<string, string>( control1, () => control1.Text, vm, () => vm.Model.MyProperty) .ObserveSourceEvent(UpdateTriggerMode.LostFocus); Assert.AreEqual(string.Empty, control1.Text); Assert.AreEqual(string.Empty, vm.Model.MyProperty); var value = DateTime.Now.Ticks.ToString(); control1.RequestFocus(); control1.Text = value; Assert.AreEqual(value, control1.Text); Assert.AreEqual(string.Empty, vm.Model.MyProperty); control1.ClearFocus(); Assert.AreEqual(control1.Text, vm.Model.MyProperty); }
public void Binding_TwoWayFromEditTextToCheckBoxWithObserveEvent_BindingGetsUpdated() { var control1 = new EditText(Application.Context); var control2 = new CheckBox(Application.Context); var binding = new Binding<string, bool>( control1, () => control1.Text, control2, () => control2.Checked, BindingMode.TwoWay) .ObserveSourceEvent(UpdateTriggerMode.LostFocus) .ObserveTargetEvent(); // LostFocus doesn't work programatically with CheckBoxes Assert.AreEqual(string.Empty, control1.Text); Assert.IsFalse(control2.Checked); var value = "True"; control1.RequestFocus(); control1.Text = value; Assert.AreEqual(value, control1.Text); Assert.IsFalse(control2.Checked); control1.ClearFocus(); Assert.IsTrue(control2.Checked); control2.Checked = false; Assert.IsFalse(control2.Checked); Assert.AreEqual("False", control1.Text); }
public override Dialog OnCreateDialog(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Begin building a new dialog. this.SetStyle(DialogFragmentStyle.Normal,Android.Resource.Style.ThemeDialog); var builder = new AlertDialog.Builder (this.Activity); //Get the layout inflater var inflater = Activity.LayoutInflater; var view = inflater.Inflate(Resource.Layout.Payment, null); txtAmt = view.FindViewById<EditText> (Resource.Id.payamt); if (txtAmt != null) { txtRound = view.FindViewById<EditText> (Resource.Id.payround); txtTotal = view.FindViewById<EditText> (Resource.Id.paytotal); txtCash = view.FindViewById<EditText> (Resource.Id.paycash); txtChange = view.FindViewById<EditText> (Resource.Id.paychange); Button butInvBack = view.FindViewById<Button> (Resource.Id.payok); txtCust = view.FindViewById<EditText> (Resource.Id.newinv_custname); txtRemark = view.FindViewById<EditText> (Resource.Id.newinv_remark); txtInvno = view.FindViewById<EditText> (Resource.Id.newinvno); txtRemark.Text = Remark; txtInvno.Text = InvNo; txtCust.Text = CustName; txtAmt.Text = _amount.ToString ("n2"); double roundVal = 0; double ttlAmt = Utility.AdjustToNear (_amount, ref roundVal); txtRound.Text = roundVal.ToString ("n2"); txtTotal.Text = ttlAmt.ToString ("n2"); txtCash.EditorAction += HandleEditorAction; txtCash.AfterTextChanged += TxtCash_AfterTextChanged; txtCash.Text = ""; butInvBack.Visibility = ViewStates.Gone; builder.SetView (view); builder.SetPositiveButton (Resources.GetString(Resource.String.button_paidprint) , HandlePositiveButtonClick); builder.SetNegativeButton (Resources.GetString(Resource.String.button_cancel),HandleNegativeButtonClick ); builder.SetNeutralButton (Resources.GetString(Resource.String.button_paid), HandlePaidOnlyButtonClick ); builder.SetCancelable (false); txtCash.RequestFocus (); ShowKeyBoard (view); } var dialog = builder.Create(); //Now return the constructed dialog to the calling activity WindowManagerLayoutParams wmlp = dialog.Window.Attributes; wmlp.Gravity = GravityFlags.Top | GravityFlags.Center; return dialog; }
public void Binding_OneWayFromEditTextToCheckBoxWithObserveEvent_BindingGetsUpdated() { var control1 = new EditText(Application.Context); var control2 = new CheckBox(Application.Context); var binding = new Binding<string, bool>( control1, () => control1.Text, control2, () => control2.Checked) .ObserveSourceEvent(UpdateTriggerMode.LostFocus); Assert.AreEqual(string.Empty, control1.Text); Assert.IsFalse(control2.Checked); var value = "True"; control1.RequestFocus(); control1.Text = value; Assert.AreEqual(value, control1.Text); Assert.IsFalse(control2.Checked); control1.ClearFocus(); Assert.IsTrue(control2.Checked); }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); if (!((GlobalvarsApp)this.Application).ISLOGON) { Finish (); } SetContentView (Resource.Layout.CreateInvoice); pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH; compCode = ((GlobalvarsApp)this.Application).COMPANY_CODE; branchCode = ((GlobalvarsApp)this.Application).BRANCH_CODE; EventManagerFacade.Instance.GetEventManager().AddListener(this); // Create your application here _date = DateTime.Today; spinner = FindViewById<Spinner> (Resource.Id.newinv_custcode); Spinner spinnerType = FindViewById<Spinner> (Resource.Id.newinv_type); Button butSave = FindViewById<Button> (Resource.Id.newinv_bsave); Button butNew = FindViewById<Button> (Resource.Id.newinv_cancel); Button butFind = FindViewById<Button> (Resource.Id.newinv_bfind); spinner.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (spinner_ItemSelected); butSave.Click += butSaveClick; butNew.Click += butCancelClick; TextView invno = FindViewById<TextView> (Resource.Id.newinv_no); invno.Text = "AUTO"; EditText trxdate = FindViewById<EditText> (Resource.Id.newinv_date); trxdate.Text = _date.ToString ("dd-MM-yyyy"); trxdate.Click += delegate(object sender, EventArgs e) { ShowDialog (0); }; butFind.Click+= (object sender, EventArgs e) => { ShowCustLookUp(); }; ccType = FindViewById<EditText> (Resource.Id.newinv_cctype); ccNo = FindViewById<EditText> (Resource.Id.newinv_ccno); ccNo.AfterTextChanged+= CcNo_AfterTextChanged; ccNo.RequestFocus (); apara = DataHelper.GetAdPara (pathToDatabase,compCode,branchCode); //SqliteConnection.CreateFile(pathToDatabase); LoadTrader (); List<string> icodes = new List<string> (); foreach (Trader item in items) { icodes.Add (item.CustCode+" | "+item.CustName); } dataAdapter = new ArrayAdapter<String> (this, Resource.Layout.spinner_item, icodes); dataAdapter2 =ArrayAdapter.CreateFromResource ( this, Resource.Array.trxtype, Resource.Layout.spinner_item); // Drop down layout style - list view with radio button dataAdapter.SetDropDownViewResource(Resource.Layout.SimpleSpinnerDropDownItemEx); dataAdapter2.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); // attaching data adapter to spinner spinner.Adapter =dataAdapter; spinnerType.Adapter =dataAdapter2; }
public void Binding_TwoWayFromEditTextToEditTextWithObserveEvent_BindingGetsUpdated() { var control1 = new EditText(Application.Context); var control2 = new EditText(Application.Context); var binding = new Binding<string, string>( control1, () => control1.Text, control2, () => control2.Text, BindingMode.TwoWay) .ObserveSourceEvent(UpdateTriggerMode.LostFocus) .ObserveTargetEvent(UpdateTriggerMode.LostFocus); Assert.AreEqual(string.Empty, control1.Text); Assert.AreEqual(string.Empty, control2.Text); var value = DateTime.Now.Ticks.ToString(); control1.RequestFocus(); control1.Text = value; Assert.AreEqual(value, control1.Text); Assert.AreEqual(string.Empty, control2.Text); control1.ClearFocus(); Assert.AreEqual(control1.Text, control2.Text); var newValue = value + "Suffix"; control2.RequestFocus(); control2.Text = newValue; Assert.AreEqual(newValue, control2.Text); Assert.AreEqual(value, control1.Text); control2.ClearFocus(); Assert.AreEqual(control2.Text, control1.Text); }
public void Binding_TwoWayFromCheckBoxToEditTextWithUpdateTrigger_BindingGetsUpdated() { var control1 = new EditText(Application.Context); var control2 = new CheckBox(Application.Context); _binding = new Binding<bool, string>( control2, () => control2.Checked, control1, () => control1.Text, BindingMode.TwoWay) .UpdateSourceTrigger() // LostFocus doesn't work programatically with CheckBoxes .ObserveTargetEvent(UpdateTriggerMode.LostFocus); Assert.AreEqual("False", control1.Text); Assert.IsFalse(control2.Checked); control2.Checked = true; Assert.IsTrue(control2.Checked); Assert.AreEqual("True", control1.Text); var value = "False"; control1.RequestFocus(); control1.Text = value; Assert.AreEqual(value, control1.Text); Assert.IsTrue(control2.Checked); control1.ClearFocus(); Assert.IsFalse(control2.Checked); }
void Txtbarcode_AfterTextChanged(EditText txtbarcode) { //EditText txtbarcode = FindViewById<EditText> (Resource.Id.txtbarcode); if (string.IsNullOrEmpty (txtbarcode.Text)) { txtbarcode.RequestFocus (); return; } var found= items.Where(x=>x.Barcode == txtbarcode.Text).ToList(); if (found.Count == 0) { txtbarcode.Text = ""; return; } var item = found [0]; AddBarCodeItem (item); RefreshItemList (); txtbarcode.Text = ""; txtbarcode.RequestFocus (); }
protected override void OnCreate(Android.OS.Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.xy_chart); mX = FindViewById<EditText>(Resource.Id.xValue); mY = FindViewById<EditText>(Resource.Id.yValue); mAdd = FindViewById<Button>(Resource.Id.add); mRenderer.ApplyBackgroundColor = true; mRenderer.BackgroundColor = Color.Argb(100, 50, 50, 50); mRenderer.AxisTitleTextSize = 16; mRenderer.ChartTitleTextSize = 20; mRenderer.LabelsTextSize = 15; mRenderer.LegendTextSize = 15; mRenderer.SetMargins(new int[] { 20, 30, 15, 0 }); mRenderer.ZoomButtonsVisible = true; mRenderer.PointSize = 5; mNewSeries = FindViewById<Button>(Resource.Id.new_series); mNewSeries.Click += (e, s) => { String seriesTitle = "Series " + mDataset.SeriesCount + 1; XYSeries series = new XYSeries(seriesTitle); mDataset.AddSeries(series); mCurrentSeries = series; XYSeriesRenderer renderer = new XYSeriesRenderer(); mRenderer.AddSeriesRenderer(renderer); renderer.PointStyle = PointStyle.Circle; renderer.FillPoints = true; renderer.DisplayChartValues = true; renderer.DisplayChartValuesDistance = 10; mCurrentRenderer = renderer; SetSeriesWidgetsEnabled(true); mChartView.Repaint(); }; mAdd.Click += (e, s) => { double x = 0; double y = 0; try { x = Double.Parse(mX.Text); } catch (Exception) { mX.RequestFocus(); return; } try { y = double.Parse(mY.Text); } catch (Exception) { mY.RequestFocus(); return; } mCurrentSeries.Add(x, y); mX.Text = ""; mY.Text = ""; mX.RequestFocus(); mChartView.Repaint(); }; }