private void OnFileImport(object sender, RoutedEventArgs e)
{
// Eng.Password = "1"; //!!!D
// Eng.ImportWallet("C:\\work\\coin\\wallet.dat", "123"); //!!D
// return; //!!D
if (!EnsurePassphraseUnlock())
return;
var wf = SelectedWalletNotNull();
var d = new OpenFileDialog();
d.InitialDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), wf.Wallet.CurrencyName);
d.Filter = "Bitcoin Wallet format|wallet.dat|All Files|*.*";
d.FileName = "wallet.dat";
if (Dialog.ShowDialog(d, this)) {
string password = "";
while (true) {
try {
wf.Wallet.ImportWallet(d.FileName, password);
break;
} catch (Exception) {
var dlg = new FormPassphrase();
dlg.labelRetype.Visibility = Visibility.Hidden;
dlg.textRetype.Visibility = Visibility.Hidden;
dlg.Title = "Enter Passphrase for imported wallet.dat";
if (!Dialog.ShowDialog(dlg, this))
break;
password = dlg.textPassword.Password;
}
}
}
}