private void selectWalletButton_Click(object sender, EventArgs e)
        {
            var curDir = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
            OpenFileDialog findWalletDialog = new OpenFileDialog();

            findWalletDialog.InitialDirectory = curDir;
            findWalletDialog.Filter = "wallet files (*.wallet)|*.wallet|All files (*.*)|*.*";
            findWalletDialog.FilterIndex = 2;
            findWalletDialog.RestoreDirectory = true;

            if (findWalletDialog.ShowDialog() == DialogResult.OK)
            {
                if(System.IO.File.Exists(findWalletDialog.FileName))
                {
                    walletPath = findWalletDialog.FileName;
                    var pPrompt = new passwordPrompt();
                    this.Hide();
                    var pResult = pPrompt.ShowDialog();
                    if(pResult != DialogResult.OK)
                    {
                        findWalletDialog.Dispose();
                        pPrompt.Dispose();
                        this.Show();
                        return;
                    }
                    else
                    {
                        walletPassword = pPrompt.walletPassword;
                        pPrompt.Dispose();
                        this.DialogResult = DialogResult.OK;
                        this.Close();
                    }
                }
            }
        }
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);

            string _pass   = "";
            string _wallet = "";
            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;
                    pPrompt.Dispose();
                }
            }
            else
            {
                SelectionPrompt sPrompt = new SelectionPrompt();
                sPrompt.ShowDialog();
                if (sPrompt.DialogResult != DialogResult.OK)
                {
                    return;
                }
                else
                {
                    _pass   = sPrompt.walletPassword;
                    _wallet = sPrompt.walletPath;
                }
            }

            //var args = new Dictionary<string, object>() { };
            //var testobj = ConnectionManager.rpcRequest("http://127.0.0.1:8070/json_rpc", "getBalance", args);
            //foreach(var item in testobj)
            //{
            //    Console.Write(item.Key + "-" + item.Value);
            //}


            var splash = new Splash(_wallet, _pass);
            Application.Run(splash);
        }
        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;
            }
        }