private async void BtnRemoveWallet_Click(object sender, RoutedEventArgs e) { UserAccountsDB UADB = new UserAccountsDB(); UserAccounts UA = new UserAccounts(); try { UA = UADB.Get(WalletName.Text); UADB.RemoveWallet(UA); PopulateWalletList(); } catch { MessageDialog ConfirmationDetailsDialog = new MessageDialog("Received Error: You need to have a wallet present in order to remove one."); ConfirmationDetailsDialog.Title = "Error"; ConfirmationDetailsDialog.Commands.Add(new UICommand("Ok") { Id = 0 }); var ConfResult = await ConfirmationDetailsDialog.ShowAsync(); } }
private async void BtnChangeWalletName_Click(object sender, RoutedEventArgs e) { MessageDialog alertDialog = new MessageDialog("Changing your Wallet Name costs 1 Burst as a fee, continue?"); alertDialog.Title = "Confirmation"; alertDialog.Commands.Add(new UICommand("Yes") { Id = 0 }); alertDialog.Commands.Add(new UICommand("No") { Id = 1 }); alertDialog.DefaultCommandIndex = 0; alertDialog.CancelCommandIndex = 1; var result = await alertDialog.ShowAsync(); if ((int)result.Id == 0) { UserAccountsDB userAccountDB = new UserAccountsDB(); try { UserAccounts[] userAccount = userAccountDB.GetAccountList(); UADB = new UserAccountsDB(); UA = UADB.Get(WalletName.Text); string SecretPhrase = StringCipher.Decrypt(UA.PassPhrase); SetAccountInfo sai = BNWAPI.setAccountInfo(New_WalletName.Text, SecretPhrase); if (sai.success) { UserAccounts NU = new UserAccounts(); NU.AccountName = New_WalletName.Text; NU.BurstAddress = BurstAddress.Text; NU.PassPhrase = StringCipher.Encrypt(SecretPhrase); UADB.Save(NU); UADB.RemoveWallet(UA); WalletName.Text = NU.AccountName; MessageDialog ConfirmationDetailsDialog = new MessageDialog("Wallets Name has been changed"); ConfirmationDetailsDialog.Title = "Confirmation"; ConfirmationDetailsDialog.Commands.Add(new UICommand("Ok") { Id = 0 }); var ConfResult = await ConfirmationDetailsDialog.ShowAsync(); PopulateWalletList(); } else { MessageDialog ConfirmationDetailsDialog = new MessageDialog("Received Error:" + sai.errorMsg); ConfirmationDetailsDialog.Title = "Error"; ConfirmationDetailsDialog.Commands.Add(new UICommand("Ok") { Id = 0 }); var ConfResult = await ConfirmationDetailsDialog.ShowAsync(); } } catch { MessageDialog ConfirmationDetailsDialog = new MessageDialog("Received Error: A valid Burstcoin wallet needs to be present before attempting to change the name. Please create a new Burstcoin wallet first."); ConfirmationDetailsDialog.Title = "Error"; ConfirmationDetailsDialog.Commands.Add(new UICommand("Ok") { Id = 0 }); var ConfResult = await ConfirmationDetailsDialog.ShowAsync(); } } else { } }