Пример #1
0
 public static InputDialogFragment NewInstance(Activity context, string title, string message, Action<int> okAction)
 {
     var frag = new InputDialogFragment();
     var args = new Bundle();
     args.PutString("title", title);
     args.PutString("message", message);
     frag.Arguments = args;
     _actionOk = okAction;
     _context = context;
     return frag;
 }
Пример #2
0
        public static InputDialogFragment NewInstance(Activity context, string title, string message, Action <int> okAction)
        {
            var frag = new InputDialogFragment();
            var args = new Bundle();

            args.PutString("title", title);
            args.PutString("message", message);
            frag.Arguments = args;
            _actionOk      = okAction;
            _context       = context;
            return(frag);
        }
Пример #3
0
        //Push data when the platform requests, works the same way as in console.
        //For the sake of this sample, we added here an Android fragment(a popup) that ask the user to enter the CVV when using a Magnetic stripe card.
        private void TransactionOrchestratorOnDataRequested(CollectInputParameters obj)
        {
            try
            {
                if (_progressDialog.IsShowing)
                {
                    _progressDialog.Dismiss();
                }

                switch (obj.Reference)
                {
                case "CVV":
                    var cvvDialog = InputDialogFragment.NewInstance(this, "PI", obj.Message, (cvvValue) =>
                    {
                        string result    = cvvValue == 0 ? "" : cvvValue.ToString();
                        var cvvParameter = new CollectOutputParameters()
                        {
                            Reference = obj.Reference, Value = result
                        };
                        _transactionOrchestrator.PushData(cvvParameter);
                    });
                    cvvDialog.Show(FragmentManager, "fragment_cvv");
                    break;

                case "CVVState":
                    var items = new List <string>();
                    foreach (var item in obj.Options)
                    {
                        items.Add(item.Value);
                    }

                    AlertDialog.Builder builder = new AlertDialog.Builder(this);
                    builder.SetTitle(obj.Message)
                    .SetItems(items.ToArray(), (sender, e) =>
                    {
                        var selectedValue = items[e.Which];
                        foreach (var item in obj.Options)
                        {
                            if (item.Value == selectedValue)
                            {
                                var cvvStateParameter = new CollectOutputParameters()
                                {
                                    Reference = obj.Reference, Value = item.Key.ToString()
                                };
                                _transactionOrchestrator.PushData(cvvStateParameter);
                                break;
                            }
                        }
                    });

                    dialog = builder.Create();
                    dialog.Show();
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                Helpers.Alert(this, "PI - TransactionOrchestratorOnDataRequested - Error", ex.Message, false);
            }
        }