Ejemplo n.º 1
0
        public override void OnResume()
        {
            base.OnResume();

            ConfigureSubscriptions();
            _searchTextEdit.RequestFocus();
        }
Ejemplo n.º 2
0
 private void CUser_EditorAction(object sender, TextView.EditorActionEventArgs e)
 {
     if (e.ActionId == Android.Views.InputMethods.ImeAction.Next)
     {
         cPassword.RequestFocus();
     }
 }
Ejemplo n.º 3
0
 private void TxtUser_EditorAction(object sender, TextView.EditorActionEventArgs e)
 {
     e.Handled = false;
     if (e.ActionId == Android.Views.InputMethods.ImeAction.Next)
     {
         txtPwd.RequestFocus();
         e.Handled = true;
     }
 }
Ejemplo n.º 4
0
        private void FocusPasswordText()
        {
            if (!_passwordText.RequestFocus())
            {
                return;
            }

            var inputManager = (InputMethodManager)Context.GetSystemService(Context.InputMethodService);

            inputManager.ShowSoftInput(_passwordText, ShowFlags.Implicit);
        }
        private async Task FocusPasswordText()
        {
            await Task.Run(async delegate
            {
                await Task.Delay(250);

                RunOnUiThread(delegate
                {
                    _passwordText.RequestFocus();
                    var inputManager = (InputMethodManager)GetSystemService(InputMethodService);
                    inputManager.ShowSoftInput(_passwordText, ShowFlags.Implicit);
                });
            });
        }
Ejemplo n.º 6
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            // Use this to return your custom view for this Fragment

            View view = inflater.Inflate(Resource.Layout.sendfragmentex, container, false);

            CreateTextViewsAndButtons(view);

            CreateRecyclerView(view);

            dataRepository = new DataRepository();

            //@@todo: change to transactionState
            if (!sendForm)
            {
                addressLayout.Hint = "E-mail address";
                addressBlankError  = "E-mail address can't be blank!";
                amountEdit.SetTextColor(Color.Green);
                dollarAmountTextView.SetTextColor(Color.Green);
                radioGroup.Visibility         = ViewStates.Gone;
                topView.Visibility            = ViewStates.Gone;
                transactionFeeText.Visibility = ViewStates.Gone;
                bottomView.Visibility         = ViewStates.Gone;
                transactionState = TransactionEnum.RECEIVE;

                sendButton.Text = "Receive payment";
            }

            if (transactionByFileAttachment)
            {
                addressLayout.Hint = "Bitcoin public address";
                addressBlankError  = "Bitcoin public address can't be blank!";
                amountEdit.SetTextColor(Android.Graphics.Color.Red);
                amountEdit.Text  = seriousWalletTransactionMessage.CoinAmount;
                addressEdit.Text = seriousWalletTransactionMessage.TransactionAddress;
                labelEdit.RequestFocus();
                InputMethodManager imm = (InputMethodManager)Context.GetSystemService(Context.InputMethodService);
                imm.ShowSoftInput(labelEdit, ShowFlags.Implicit);
            }

            return(view);
        }
        private void FocusPasswordText()
        {
            RunOnUiThread(delegate
            {
                if (_unlockLayout.Visibility == ViewStates.Visible)
                {
                    return;
                }

                AnimUtil.FadeInView(_unlockLayout, AnimUtil.LengthLong, true, delegate
                {
                    if (!_passwordText.RequestFocus())
                    {
                        return;
                    }

                    var inputManager = (InputMethodManager)GetSystemService(InputMethodService);
                    inputManager.ShowSoftInput(_passwordText, ShowFlags.Implicit);
                });
            });
        }
Ejemplo n.º 8
0
        private async Task DoThings()
        {
            if (cUser.Text == "" || cPassword.Text == "")
            {
                cMsgText.Text = "Please input correct User and Password";
            }
            else
            {
                this.RunOnUiThread(() =>
                {
                    cUser.Enabled     = false;
                    cPassword.Enabled = false;
                });
                gDatos.DataBase = "SISTEMAS";
                gDatos.Server   = LogonDetails.ConnectionServer;
                gDatos.User     = "******";
                gDatos.Password = "******";
                bool error = false;

                try
                {
                    await gDatos.ConnectAsync();

                    //RunOnUiThread(async () => { });
                }
                catch (Exception ex)
                {
                    var builder = new Android.Support.V7.App.AlertDialog.Builder(this);
                    builder.SetTitle("ERROR");
                    builder.SetIcon(Android.Resource.Drawable.IcDialogAlert);
                    builder.SetMessage("Error: " + ex.Message);
                    builder.SetNeutralButton("OK", delegate
                    {
                        Intent intent = new Intent();
                        intent.PutExtra("Result", "ERROR");
                        SetResult(Result.Ok, intent);
                        Finish();
                    });
                    RunOnUiThread(() => { builder.Create().Show(); });
                    error = true;
                }
                if (!error)
                {
                    RSFrame _RS;
                    _RS = (RSFrame)CObjectFactory.CreateObject("RS", typeofCaller, "select date=getdate()", gDatos);
                    await _RS.OpenAsync();

                    gDatos.Close();
                    SPFrame LogonSP;
                    LogonSP = (SPFrame)CObjectFactory.CreateObject("SP", typeofCaller, gDatos, "pLogonUser");
                    LogonSP.AddParameterValue("User", cUser.Text);
                    LogonSP.AddParameterValue("Password", cPassword.Text);
                    LogonSP.AddParameterValue("Origin", packageName.ToUpper());
                    LogonSP.AddParameterValue("FullName", "");
                    string _version     = "123456";
                    string _packageName = "123456789";
                    LogonSP.AddParameterValue("Version", _version);
                    LogonSP.AddParameterValue("PackageName", _packageName);
                    try
                    {
                        await LogonSP.ExecuteAsync();

                        if (LogonSP.LastMsg.Substring(0, 2) != "OK")
                        {
                            throw new Exception(LogonSP.LastMsg);
                        }
                        else
                        {
                            Toast.MakeText(this, "Logon OK!", ToastLength.Short).Show();
                            LogonDetails.User     = LogonSP.ReturnValues()["@User"].ToString();
                            LogonDetails.Password = LogonSP.ReturnValues()["@Password"].ToString();
                            LogonDetails.FullName = LogonSP.ReturnValues()["@FullName"].ToString();
                            _version = LogonSP.ReturnValues()["@Version"].ToString();
                            var _versionArray = _version.Split('.');
                            _version = string.Format("{0}.{1}", _versionArray[0], _versionArray[1]);
                            var versionArray = version.Split('.');
                            version      = string.Format("{0}.{1}", versionArray[0], versionArray[1]);
                            _packageName = LogonSP.ReturnValues()["@PackageName"].ToString();
#if DEBUG
                            //if (true)
                            if (Convert.ToSingle(_version) > Convert.ToSingle(version))
#else
                            if (Convert.ToSingle(_version) > Convert.ToSingle(version))
#endif


                            {
                                bool dialogResult = await AlertDialogHelper.ShowAsync(this, "New version found", "Do you want to update your current program?", "Yes", "No");

                                if (dialogResult)
                                {
                                    try
                                    {
                                        Window.SetFlags(Android.Views.WindowManagerFlags.NotTouchable, Android.Views.WindowManagerFlags.NotTouchable);
                                        progressBarHolder.Visibility = ViewStates.Visible;
                                        await UpdatePackageURL(_packageName);

                                        //pd.Dismiss();
                                        progressBarHolder.Visibility = ViewStates.Gone;
                                        Window.ClearFlags(WindowManagerFlags.NotTouchable);
                                    }
                                    catch (Exception ex)
                                    {
                                        Window.ClearFlags(WindowManagerFlags.NotTouchable);
                                        cMsgText.Text = string.Format("Error updating app, {0}: {1}", ex.Message, ex.InnerException.Message);
                                        Window.ClearFlags(WindowManagerFlags.NotTouchable);
                                    }
                                }
                            }
                            Intent intent = new Intent();
                            intent.PutExtra("Result", "OK");
                            SetResult(Result.Ok, intent);
                            Finish();
                        }
                    }
                    catch (Exception ex)
                    {
                        cMsgText.Text  = string.Format("{0}: {1}", ex.Message, ex.InnerException.Message);
                        cUser.Text     = "";
                        cPassword.Text = "";
#if DEBUG
                        cUser.Text     = "restelles";
                        cPassword.Text = "1312";
#endif
                        cUser.RequestFocus();
                    }
                }
                this.RunOnUiThread(() =>
                {
                    cUser.Enabled     = true;
                    cPassword.Enabled = true;
                });
            }
        }
        private void _textInputEditText_TextChanged(object sender, TextChangedEventArgs e)
        {
            var edtTxt = (EditText)sender;

            if (!edtTxt.HasFocus)
            {
                return;
            }
            if (e.AfterCount == 0)
            {
                switch (edtTxt.Id)
                {
                case Resource.Id.textInputEditText1:
                    return;

                case Resource.Id.textInputEditText2:
                    _textInputEditText1.RequestFocus();
                    break;

                case Resource.Id.textInputEditText3:
                    _textInputEditText2.RequestFocus();
                    break;

                case Resource.Id.textInputEditText4:
                    _textInputEditText3.RequestFocus();
                    break;

                case Resource.Id.textInputEditText5:
                    _textInputEditText4.RequestFocus();
                    break;

                case Resource.Id.textInputEditText6:
                    _textInputEditText5.RequestFocus();
                    break;

                default:
                    return;
                }
            }
            else
            {
                switch (edtTxt.Id)
                {
                case Resource.Id.textInputEditText1 when !string.IsNullOrEmpty(edtTxt.Text):
                    _textInputEditText2.RequestFocus();
                    break;

                case Resource.Id.textInputEditText2 when !string.IsNullOrEmpty(edtTxt.Text):
                    _textInputEditText3.RequestFocus();
                    break;

                case Resource.Id.textInputEditText3 when !string.IsNullOrEmpty(edtTxt.Text):
                    _textInputEditText4.RequestFocus();
                    break;

                case Resource.Id.textInputEditText4 when !string.IsNullOrEmpty(edtTxt.Text):
                    _textInputEditText5.RequestFocus();
                    break;

                case Resource.Id.textInputEditText5 when !string.IsNullOrEmpty(edtTxt.Text):
                    _textInputEditText6.RequestFocus();
                    break;

                case Resource.Id.textInputEditText6 when !string.IsNullOrEmpty(edtTxt.Text):
                    var verificationCode = string.Concat(_textInputEditText1.Text, _textInputEditText2.Text,
                                                         _textInputEditText3.Text, _textInputEditText4.Text, _textInputEditText5.Text,
                                                         _textInputEditText6.Text);
                    VerifySentCode(verificationCode);
                    break;
                }
            }
        }
Ejemplo n.º 10
0
        private void CreateTextViewsAndButtons(View view)
        {
            amountLayout  = view.FindViewById <TextInputLayout>(Resource.Id.amountLayoutFrag);
            addressLayout = view.FindViewById <TextInputLayout>(Resource.Id.userNameLayoutFrag);
            labelLayout   = view.FindViewById <TextInputLayout>(Resource.Id.labelLayoutFrag);

            amountEdit           = view.FindViewById <TextInputEditText>(Resource.Id.amountEditFrag);
            addressEdit          = view.FindViewById <TextInputEditText>(Resource.Id.userNameTextEditFrag);
            labelEdit            = view.FindViewById <TextInputEditText>(Resource.Id.labelEditFrag);
            dollarAmountTextView = view.FindViewById <TextView>(Resource.Id.dollarAmountTextViewFrag);

            amountEdit.ClearFocus();

            amountEdit.RequestFocus();

            //@@todo: convert to lambda functions
            amountEdit.FocusChange += AmountTextView_FocusChange;

            dollarAmountTextView.SetTextColor(Color.Red);

            amountEdit.TextChanged += (sender, e) =>
            {
                string amount = amountEdit.Text;

                if (!amount.Any(char.IsDigit))
                {
                    return;
                }

                decimal value = System.Convert.ToDecimal(amount) * coinDollarValue;
                dollarAmountTextView.Text = value.ToString("C");
            };

            addressEdit.FocusChange += AddressTextView_FocusChange;
            addressEdit.TextChanged += (sender, e) =>
            {
                addressBookAdapter.Filter(e.Text.ToString());
            };

            //@@todo: convert to lambda functions
            labelEdit.FocusChange += LabelTextView_FocusChange;

            buttonLayout = view.FindViewById <LinearLayout>(Resource.Id.buttonLayoutFrag);

            addressBookButton = view.FindViewById <Button>(Resource.Id.addressBookFrag);
            qrCodeButton      = view.FindViewById <Button>(Resource.Id.qrCodeFrag);
            clearButton       = view.FindViewById <Button>(Resource.Id.clearFrag);

            clearButton.Click += (sender, e) =>
            {
                addressEdit.Text = null;
            };

            //@@todo: convert to lambda functions
            addressBookButton.Click += AddressBookButton_Click;

            sendButton         = view.FindViewById <Button>(Resource.Id.sendFrag);
            radioGroup         = view.FindViewById <RadioGroup>(Resource.Id.feesRadioGroup);
            topView            = view.FindViewById <View>(Resource.Id.topView);
            transactionFeeText = view.FindViewById <TextView>(Resource.Id.transactionFeeText);
            bottomView         = view.FindViewById <View>(Resource.Id.bottomView);

            //@@todo: convert to lambda functions
            sendButton.Click += async(sender, e) =>
            {
                if (!UserInputsFilled())
                {
                    return;
                }

                switch (transactionState)
                {
                case TransactionEnum.RECEIVE:
                    HandleReceiveTask();
                    break;

                case TransactionEnum.SEND:
                    await HandleSendTaks();

                    break;

                default:
                    break;
                }
            };
        }