Example #1
0
        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);
                    }
                }
            }
        }
Example #2
0
        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;
            }
        }
        static void Main()
        {
            /* Delete walletd.log if it exists so we can ensure when reading
             * the file later upon a crash, that we are reporting the proper
             * crash reason and not some previous crash */
            System.IO.File.Delete("walletd.log");

#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;
            }
        }