Example #1
0
        private async void ButtonSendTransaction_ClickAsync(object sender, EventArgs e)
        {
            try
            {
                string amountstring = textBoxAmount.Text.Replace(",", ".");
                string feestring    = textBoxFee.Text.Replace(",", ".");

                var checkAmount = CheckAmount(amountstring);
                var checkFee    = CheckAmount(feestring);
                if (checkAmount.Item1)
                {
                    var amountSend = checkAmount.Item2;
                    if (checkFee.Item1)
                    {
                        var feeSend = checkFee.Item2;
                        if (CheckAmountNetwork(amountSend + feeSend))
                        {
                            string destination = ClassUtility.RemoveSpecialCharacters(textBoxWalletDestination.Text);
                            if ((destination.Length >= 48 &&
                                 destination.Length <= 128) && Regex.IsMatch(
                                    destination,
                                    "[a-z0-9]+", RegexOptions.IgnoreCase))
                            {
#if WINDOWS
                                if (ClassFormPhase.MessageBoxInterface(ClassTranslation.GetLanguageTextFromOrder("SEND_TRANSACTION_WALLET_MESSAGE_SUBMIT_CONTENT_TEXT").Replace(ClassTranslation.AmountSendOrder, "" + amountSend).Replace(ClassTranslation.TargetAddressOrder, destination),
                                                                       ClassTranslation.GetLanguageTextFromOrder("SEND_TRANSACTION_WALLET_MESSAGE_SUBMIT_TITLE_TEXT"), MessageBoxButtons.YesNo, MessageBoxIcon.Warning) ==
                                    DialogResult.Yes)
#else
                                if (MessageBox.Show(ClassFormPhase.WalletXiropht, ClassTranslation.GetLanguageTextFromOrder("SEND_TRANSACTION_WALLET_MESSAGE_SUBMIT_CONTENT_TEXT").Replace(ClassTranslation.AmountSendOrder, "" + amountSend).Replace(ClassTranslation.TargetAddressOrder, destination),
                                                    ClassTranslation.GetLanguageTextFromOrder("SEND_TRANSACTION_WALLET_MESSAGE_SUBMIT_TITLE_TEXT"), MessageBoxButtons.YesNo, MessageBoxIcon.Warning) ==
                                    DialogResult.Yes)
#endif
                                {
                                    ClassParallelForm.ShowWaitingForm();

                                    if (checkBoxHideWalletAddress.Checked)
                                    {
                                        await ClassWalletObject.WalletConnect.SendPacketWallet(
                                            ClassWalletCommand.ClassWalletSendEnumeration.SendTransaction + "|" +
                                            destination + "|" + amountSend + "|" + feeSend + "|1", ClassWalletObject.Certificate, true);
                                    }
                                    else
                                    {
                                        await ClassWalletObject.WalletConnect.SendPacketWallet(
                                            ClassWalletCommand.ClassWalletSendEnumeration.SendTransaction + "|" +
                                            destination + "|" + amountSend + "|" + feeSend + "|0", ClassWalletObject.Certificate, true);
                                    }

                                    MethodInvoker invoke = () =>
                                    {
                                        checkBoxHideWalletAddress.Checked = false;
                                        textBoxAmount.Text            = "0.00000000";
                                        textBoxFee.Text               = "0.00001000";
                                        textBoxWalletDestination.Text = string.Empty;
                                    };
                                    BeginInvoke(invoke);
                                }
                            }
                            else
                            {
#if WINDOWS
                                ClassFormPhase.MessageBoxInterface(ClassTranslation.GetLanguageTextFromOrder("SEND_TRANSACTION_WALLET_MESSAGE_ERROR_TARGET_CONTENT_TEXT"), string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Error);
#else
                                MessageBox.Show(ClassFormPhase.WalletXiropht, ClassTranslation.GetLanguageTextFromOrder("SEND_TRANSACTION_WALLET_MESSAGE_ERROR_TARGET_CONTENT_TEXT"));
#endif
                            }
                        }
                    }
                    else
                    {
#if WINDOWS
                        ClassFormPhase.MessageBoxInterface(ClassTranslation.GetLanguageTextFromOrder("SEND_TRANSACTION_WALLET_MESSAGE_ERROR_FEE_CONTENT_TEXT"), string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Error);
#else
                        MessageBox.Show(ClassFormPhase.WalletXiropht, ClassTranslation.GetLanguageTextFromOrder("SEND_TRANSACTION_WALLET_MESSAGE_ERROR_FEE_CONTENT_TEXT"));
#endif
                    }
                }
                else
                {
#if WINDOWS
                    ClassFormPhase.MessageBoxInterface(ClassTranslation.GetLanguageTextFromOrder("SEND_TRANSACTION_WALLET_MESSAGE_ERROR_AMOUNT_CONTENT_TEXT"), string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Error);
#else
                    MessageBox.Show(ClassFormPhase.WalletXiropht, ClassTranslation.GetLanguageTextFromOrder("SEND_TRANSACTION_WALLET_MESSAGE_ERROR_AMOUNT_CONTENT_TEXT"));
#endif
                }
            }
            catch (Exception error)
            {
                Console.WriteLine("Exception error: " + error.Message);
            }
            Refresh();
        }
Example #2
0
 private void textBoxWalletDestination_TextChanged(object sender, EventArgs e)
 {
     textBoxWalletDestination.Text = ClassUtility.RemoveSpecialCharacters(textBoxWalletDestination.Text);
 }