private void btnNext_Click(object sender, RoutedEventArgs e) { string checkField = CheckParameter(); if (checkField != "STR_NW_SUC_WALLET") { txbStatus.Text = StringTable.GetInstance().GetString(checkField, iLang); txbStatus.Visibility = Visibility.Visible; return; } txbStatus.Text = StringTable.GetInstance().GetString(checkField, iLang); UserWallet wallet; try { if (rdbAnonymous.IsChecked == true) { wallet = UserWallet.Create(txbWalletPath.Text, txbPassword.Password, KeyType.Anonymous); } else if (rdbTransparent.IsChecked == true) { wallet = UserWallet.Create(txbWalletPath.Text, txbPassword.Password, KeyType.Transparent); } else if (rdbStealth.IsChecked == true) { wallet = UserWallet.Create(txbWalletPath.Text, txbPassword.Password, KeyType.Stealth); } else { txbStatus.Text = StringTable.GetInstance().GetString("STR_NW_ERR_UNKNOWN", iLang); txbStatus.Visibility = Visibility.Visible; return; } Settings.Default.LastWalletPath = txbWalletPath.Text; Settings.Default.Save(); } catch (Exception ex) { txbStatus.Text = StringTable.GetInstance().GetString("STR_NW_ERR_UNKNOWN", iLang); txbStatus.Visibility = Visibility.Visible; LogManager.WriteExceptionLogs(ex); return; } MainWalletWnd = new MainWalletWindow(wallet); MainWalletWnd.Show(); isNext = true; this.Close(); }
private void btnNext_Click(object sender, RoutedEventArgs e) { btnNext.IsEnabled = false; string checkField = CheckStatus(); if (checkField != "STR_RW_SUCCESS") { txbStatus.Text = StringTable.GetInstance().GetString(checkField); txbStatus.Visibility = Visibility.Visible; btnNext.IsEnabled = true; return; } txbStatus.Text = StringTable.GetInstance().GetString(checkField); string walletPath = txbWalletPath.Text; string password = txbPassword.Password; Task.Run(() => { UserWallet wallet; try { wallet = UserWallet.Open(walletPath, password); Settings.Default.LastWalletPath = walletPath; Settings.Default.Save(); this.Dispatcher.BeginInvoke(new Action(() => { MainWalletWnd = new MainWalletWindow(wallet); MainWalletWnd.Show(); isNext = true; this.Close(); })); } catch (CryptographicException) { this.Dispatcher.BeginInvoke(new Action(() => { txbStatus.Text = StringTable.GetInstance().GetString("STR_RW_ERR_INCORRECT_PASSWORD"); txbStatus.Visibility = Visibility.Visible; btnNext.IsEnabled = true; })); return; } catch (FormatException ex) { this.Dispatcher.BeginInvoke(new Action(() => { txbStatus.Text = StringTable.GetInstance().GetString("STR_RW_ERR_UNKNOWN"); txbStatus.Visibility = Visibility.Visible; LogManager.WriteExceptionLogs(ex); btnNext.IsEnabled = true; })); return; } }); }