public static AddWalletDialogFragment NewInstance(string[] networkProviders, WalletInfo wallet = null, bool edit = false)
        {
            AddWalletDialogFragment fragment = new AddWalletDialogFragment();
            Bundle bundle = new Bundle();

            bundle.PutStringArray("networks", networkProviders);
            bundle.PutBoolean("edit", edit);
            if (wallet != null)
            {
                bundle.PutString("wallet", JsonConvert.SerializeObject(wallet));
            }

            fragment.Arguments = bundle;
            return(fragment);
        }
 private void OnAddWallet(object sender, EventArgs e)
 {
     AddWalletDialogFragment.NewInstance(NetworkProviders.Values.ToArray()).Show(FragmentManager, "add-wallet");
 }
        protected async Task LoadWalletsAsync(bool allowInterogation = false)
        {
            var proxy    = ProxyFactory.GetProxyInstace();
            var response = await proxy.ExecuteAsync(API.Endpoints.WalletEndpoints.GetMyWallets());

            if (CustomApplication.CurrentActivity != this)
            {
                return;
            }

            if (response.Successful)
            {
                wallets = await response.GetDataAsync <IList <WalletInfo> >();

                itemsAdapter.Items = wallets;

                //
                if (wallets.Count == 0)
                {
                    emptyFrame.Visibility = ViewStates.Visible;
                    listView.Visibility   = ViewStates.Gone;
                }
                else
                {
                    emptyFrame.Visibility = ViewStates.Gone;
                    listView.Visibility   = ViewStates.Visible;
                }

                //
                if (wallets.Count == 0 && allowInterogation)
                {
                    new AlertDialog.Builder(this)
                    .SetTitle("Setup Wallet")
                    .SetHtml($"Hi <b>{proxy.User.FullName.Split(' ').First()}</b>, Seems you havn't created any wallet yet. Do you want to create a new wallet with your phone number <b>{proxy.User.Phone}</b>?")
                    .SetPositiveButton("Create Wallet", delegate
                    {
                        //
                        string phone    = proxy.User.Phone;
                        string provider = null;

                        if (phone.StartsWith("020") || phone.StartsWith("050"))
                        {
                            provider = NetworkProviders["Vodafone"];
                        }

                        else if (phone.StartsWith("054") || phone.StartsWith("024"))
                        {
                            provider = NetworkProviders["MTN"];
                        }

                        else if (phone.StartsWith("027") || phone.StartsWith("057"))
                        {
                            provider = NetworkProviders["Tigo"];
                        }

                        else if (phone.StartsWith("023"))
                        {
                            provider = NetworkProviders["Airtel"];
                        }

                        AddWalletDialogFragment.NewInstance(NetworkProviders.Values.ToArray(), new WalletInfo()
                        {
                            Provider = provider,
                            Value    = phone
                        }, false).Show(FragmentManager, "add-wallet");
                    })
                    .SetNegativeButton("Nope Thanks", delegate
                    {
                        if (createOnly)
                        {
                            SetResult(Result.Canceled);
                            Finish();
                        }
                    })
                    .Show();
                }
            }
            else
            {
                Toast.MakeText(this, response.GetErrorDescription(), ToastLength.Short).Show();
            }
        }