Exemple #1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource.
            SetContentView(Resource.Layout.Main);

            editText = FindViewById <EditText> (Resource.Id.editText);
            Button validateButton = FindViewById <Button> (Resource.Id.validateButton);

            resultLabel = FindViewById <DecodeTextView> (Resource.Id.resultLabel);

            editText.KeyListener = Android.Text.Method.DigitsKeyListener.GetInstance("0123456789" + System.Globalization.CultureInfo.CurrentCulture.NumberFormat.CurrencyDecimalDigits);

            validateButton.Click += OnNumberEntryCompleted;

            editText.SetTypeface(typeFaceRegular, TypefaceStyle.Normal);
            validateButton.SetTypeface(typeFaceRegular, TypefaceStyle.Normal);
            resultLabel.SetTypeface(typeFaceRegular, TypefaceStyle.Normal);

//			editText.KeyPress += (object sender, View.KeyEventArgs e) => {
//				e.Handled = false;
//
//				if (e.Event.Action == KeyEventActions.Down && e.KeyCode == Keycode.Enter) {
//					var entry = editText;
//					var resultText = "";
//
//					if (Mod10Check (entry.Text)) {
//						resultText = "__VALID NUMBER";
//					} else {
//						resultText = "INVALID NUMBER";
//					}
//
//					resultLabel.AnimateText (true, resultText, 10);
//
//					e.Handled = true;
//				}
//			};
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            // Set our view from the "main" layout resource.
            SetContentView (Resource.Layout.Main);

            editText = FindViewById<EditText> (Resource.Id.editText);
            Button validateButton = FindViewById<Button> (Resource.Id.validateButton);
            resultLabel = FindViewById<DecodeTextView> (Resource.Id.resultLabel);

            editText.KeyListener = Android.Text.Method.DigitsKeyListener.GetInstance("0123456789" + System.Globalization.CultureInfo.CurrentCulture.NumberFormat.CurrencyDecimalDigits);

            validateButton.Click += OnNumberEntryCompleted;

            editText.SetTypeface(typeFaceRegular, TypefaceStyle.Normal);
            validateButton.SetTypeface(typeFaceRegular, TypefaceStyle.Normal);
            resultLabel.SetTypeface(typeFaceRegular, TypefaceStyle.Normal);

            //			editText.KeyPress += (object sender, View.KeyEventArgs e) => {
            //				e.Handled = false;
            //
            //				if (e.Event.Action == KeyEventActions.Down && e.KeyCode == Keycode.Enter) {
            //					var entry = editText;
            //					var resultText = "";
            //
            //					if (Mod10Check (entry.Text)) {
            //						resultText = "__VALID NUMBER";
            //					} else {
            //						resultText = "INVALID NUMBER";
            //					}
            //
            //					resultLabel.AnimateText (true, resultText, 10);
            //
            //					e.Handled = true;
            //				}
            //			};
        }