コード例 #1
0
ファイル: WalletPage.xaml.cs プロジェクト: paket-core/mobile
 private void FieldCompleted(object sender, EventArgs e)
 {
     if (sender == EntryRecepient)
     {
         if (!ValidationHelper.ValidateNumber(EntryAmount.Text))
         {
             EntryAmount.Focus();
         }
     }
     else if (sender == EntryAmount)
     {
         if (!ValidationHelper.ValidateTextField(EntryRecepient.Text))
         {
             EntryRecepient.FocusField();
         }
     }
     else if (sender == EntryAmountForBUL)
     {
         if (PickerBULCurrency.SelectedItem == null)
         {
             PickerBULCurrency.Focus();
         }
     }
     else if (sender == EntryAmountForXLM)
     {
         if (PickerXLMCurrency.SelectedItem == null)
         {
             PickerXLMCurrency.Focus();
         }
     }
 }
コード例 #2
0
ファイル: WalletPage.xaml.cs プロジェクト: paket-core/mobile
        protected override bool IsValid()
        {
            if (!ValidationHelper.ValidateTextField(EntryRecepient.Text))
            {
                EntryRecepient.Focus();
                return(false);
            }
            if (!ValidationHelper.ValidateNumber(EntryAmount.Text))
            {
                EntryAmount.Focus();
                return(false);
            }

            return(true);
        }
コード例 #3
0
ファイル: WalletPage.xaml.cs プロジェクト: paket-core/mobile
        private async void SendClicked(object sender, EventArgs e)
        {
            if (EntryRecepient.IsBusy)
            {
                return;
            }
            else if (recipient.Length == 0)
            {
                EntryRecepient.FocusField();
            }
            else if (IsValid())
            {
                Unfocus();

                App.ShowLoading(true);

                try
                {
                    double amount = double.Parse(EntryAmount.Text);

                    var trans = await App.Locator.BridgeServiceClient.PrepareSendBuls(App.Locator.Profile.Pubkey, recipient, amount);

                    if (trans != null)
                    {
                        var signed = await StellarHelper.SignTransaction(App.Locator.Profile.KeyPair, trans.Transaction);

                        var result = await App.Locator.BridgeServiceClient.SubmitTransaction(signed);

                        if (result != null)
                        {
                            await ViewModel.Load();

                            SundBULSMainStackView.IsVisible = false;
                            SendBULSSuccessView.IsVisible   = true;
                        }
                    }
                }
                catch (Exception ex)
                {
                    EventHandler handler = (se, ee) =>
                    {
                        if (ee != null)
                        {
                            ShowEntry(PurchaseBULEntryViews);

                            if (PickerBULCurrency.SelectedItem == null)
                            {
                                PickerBULCurrency.Focus();
                            }
                        }
                        else
                        {
                            EntryAmount.Focus();
                        }
                    };

                    if (ex.Message == AppResources.InsufficientBULs)
                    {
                        ShowErrorMessage(AppResources.PurchaseBULs, false, handler, AppResources.Purchase);
                    }
                    else
                    {
                        ShowErrorMessage(ex.Message, false, handler);
                    }
                }

                App.ShowLoading(false);

                EnableDisableButton();
            }
        }