private void SelectWalletButton_Click(object sender, EventArgs e) { var curDir = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); OpenFileDialog findwalletdialog = new OpenFileDialog { InitialDirectory = curDir, Filter = "wallet files (*.wallet)|*.wallet|All files (*.*)|*.*", FilterIndex = 2, RestoreDirectory = true }; if (findwalletdialog.ShowDialog() == DialogResult.OK) { if (System.IO.File.Exists(findwalletdialog.FileName)) { WalletPath = findwalletdialog.FileName; var pPrompt = new PasswordPrompt(); Utilities.Hide(this); var pResult = pPrompt.ShowDialog(); if (pResult != DialogResult.OK) { findwalletdialog.Dispose(); Utilities.Close(pPrompt); this.Show(); return; } else { WalletPassword = pPrompt.WalletPassword; Utilities.Close(pPrompt); Utilities.SetDialogResult(this, DialogResult.OK); Utilities.Close(this); } } } }
static void Main() { #if DEBUG Properties.Settings.Default.Reset(); #endif if (Environment.OSVersion.Version.Major >= 6) { SetProcessDPIAware(); } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var uPrompt = new UpdatePrompt(); uPrompt.ShowDialog(); string _pass = ""; string _wallet = ""; /* Reopen wallet from last time */ if (Properties.Settings.Default.walletPath != "" && System.IO.File.Exists(Properties.Settings.Default.walletPath)) { var pPrompt = new PasswordPrompt(); var pResult = pPrompt.ShowDialog(); if (pResult != DialogResult.OK) { SelectionPrompt sPrompt = new SelectionPrompt(); sPrompt.ShowDialog(); if (sPrompt.DialogResult != DialogResult.OK) { return; } else { _pass = sPrompt.WalletPassword; _wallet = sPrompt.WalletPath; } } else { _pass = pPrompt.WalletPassword; _wallet = Properties.Settings.Default.walletPath; Utilities.Close(pPrompt); } } else { SelectionPrompt sPrompt = new SelectionPrompt(); sPrompt.ShowDialog(); if (sPrompt.DialogResult != DialogResult.OK) { return; } else { _pass = sPrompt.WalletPassword; _wallet = sPrompt.WalletPath; } } jumpBackFlag: var splash = new Splash(_wallet, _pass); Application.Run(splash); if (jumpBack) //Hacky, but will work for now until a proper loop can be placed. { jumpBack = false; goto jumpBackFlag; } }