private void CreateWalletButton_Click(object sender, EventArgs e)
 {
     WalletPassword = passwordText.Text;
     Utilities.SetAppClosing(false);
     this.DialogResult = DialogResult.OK;
     Utilities.Close(this);
 }
        private void CancelButton_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult = MessageBox.Show("Are you sure you want to cancel?", "Turtle Wallet Cancel?", MessageBoxButtons.YesNo);

            if (dialogResult == DialogResult.Yes)
            {
                Utilities.Close(this);
            }
        }
Example #3
0
        private void CancelButton_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult = MessageBox.Show("Are you sure you want to cancel your bitcoin nova Wallet import?", "Cancel wallet import?", MessageBoxButtons.YesNo);

            if (dialogResult == DialogResult.Yes)
            {
                Utilities.SetDialogResult(this, DialogResult.Cancel);
                Utilities.Close(this);
            }
        }
Example #4
0
        private void CancelButton_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult = MessageBox.Show("Are you sure you want to cancel your Turtle Wallet creation?", "Cancel wallet creation?", MessageBoxButtons.YesNo);

            if (dialogResult == DialogResult.Yes)
            {
                Utilities.SetAppClosing(false);
                this.DialogResult = DialogResult.Cancel;
                Utilities.Close(this);
            }
        }
 private void PasswordText_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         if (passwordText.Text != "" && passwordText.Text.Length > 6)
         {
             WalletPassword    = passwordText.Text;
             this.DialogResult = DialogResult.OK;
             Utilities.Close(this);
         }
     }
 }
 private void SplashBackgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     if (Program.jumpBack)
     {
         Utilities.Close(this);
     }
     else
     {
         Utilities.Hide(this);
         var walletWindow = new wallet(WalletPath, WalletPassword, (Process)e.Result);
         walletWindow.Closed += (s, args) => Utilities.Close(this);
         walletWindow.Show();
     }
 }
Example #7
0
        private void ImportWalletButton_Click(object sender, EventArgs e)
        {
            ImportWalletPrompt IWP = new ImportWalletPrompt();

            Utilities.Hide(this);
            var IWPreturn = IWP.ShowDialog();

            if (IWPreturn == DialogResult.OK)
            {
                WalletPath     = IWP.ImportWalletPath;
                WalletPassword = IWP.ImportWalletPassword;
                Utilities.SetDialogResult(this, DialogResult.OK);
                Utilities.Close(IWP);
                Utilities.Close(this);
            }
            this.Show();
        }
Example #8
0
        private void CreateWalletButton_Click(object sender, EventArgs e)
        {
            CreateWalletPrompt CWP = new CreateWalletPrompt();

            Utilities.Hide(this);
            var CWPreturn = CWP.ShowDialog();

            if (CWPreturn == DialogResult.OK)
            {
                WalletPath     = CWP.WalletPath;
                WalletPassword = CWP.WalletPassword;
                Utilities.SetDialogResult(this, DialogResult.OK);
                Utilities.Close(CWP);
                Utilities.Close(this);
            }
            this.Show();
        }
Example #9
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.SetAppClosing(false);
                        this.DialogResult = DialogResult.OK;
                        Utilities.Close(this);
                    }
                }
            }
        }
Example #10
0
 private void CreateWalletButton_Click(object sender, EventArgs e)
 {
     Utilities.Close(this);
 }
Example #11
0
        private void Refresh_ui()
        {
            globalRefreshCount++;
            Newtonsoft.Json.Linq.JObject status = null;
            Newtonsoft.Json.Linq.JToken  blocks = null;

            try
            {
                this.updateLabel.BeginInvoke((MethodInvoker) delegate()
                {
                    updateLabel.Text      = "Syncing Network ...";
                    updateLabel.ForeColor = Color.FromArgb(255, 128, 0);
                });

                var balances = ConnectionManager.Request("getBalance");
                if (balances.Item1 == false)
                {
                    throw new Exception("getBalance call failed: " + balances.Item2);
                }

                float availableBal = (float)(balances.Item3["availableBalance"]) / 100;
                float lockedBal    = (float)(balances.Item3["lockedAmount"]) / 100;

                this.availableAmountLabel.BeginInvoke((MethodInvoker) delegate() { this.availableAmountLabel.Text = availableBal.ToString("0.00") + " TRTL"; });
                this.lockedAmountLabel.BeginInvoke((MethodInvoker) delegate() { this.lockedAmountLabel.Text = lockedBal.ToString("0.00") + " TRTL"; });

                var Addresses = ConnectionManager.Request("getAddresses");
                if (Addresses.Item1 == false)
                {
                    throw new Exception("getAddresses call failed: " + balances.Item2);
                }

                var addressList = Addresses.Item3["addresses"];
                this.myAddressText.BeginInvoke((MethodInvoker) delegate() { myAddressText.Text = addressList[0].ToString(); });

                status = ConnectionManager.Request("getStatus").Item3;
                var parameters = new Dictionary <string, object>()
                {
                    { "blockCount", (int)status["blockCount"] },
                    { "firstBlockIndex", 1 },
                    { "addresses", addressList }
                };

                var blocksRet = ConnectionManager.Request("getTransactions", parameters);
                if (blocksRet.Item1 == false)
                {
                    throw new Exception("getTransactions call failed: " + balances.Item2);
                }

                blocks         = blocksRet.Item3["items"];
                currentTimeout = 0;
                currentTry     = 0;
            }
            catch (Exception)
            {
                this.updateLabel.BeginInvoke((MethodInvoker) delegate()
                {
                    updateLabel.Text = "Daemon error, retrying ...";
                    windowLogger.Log(LogTextbox, "Daemon error, retrying ...");
                    updateLabel.ForeColor = Color.FromArgb(205, 12, 47);
                });

                if (currentTimeout >= watchdogTimeout)
                {
                    if (currentTry <= watchdogMaxTry)
                    {
                        //daemon restart
                    }
                    else
                    {
                        MessageBox.Show("Turtle Wallet has tried numerous times to relaunch the needed daemon and has failed. Please relaunch the wallet!", "Walletd daemon could not be recovered!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        windowLogger.Log(LogTextbox, "Turtle Wallet has tried numerous times to relaunch the needed daemon and has failed. Please relaunch the wallet!");
                        Utilities.Close(this);
                    }
                }
                else
                {
                    currentTimeout++;
                }

                return;
            }

            if (blocks == null)
            {
                return;
            }

            bool _trxFound = false;

            foreach (var block in blocks.Reverse())
            {
                var bblock = (Newtonsoft.Json.Linq.JObject)block;
                if (bblock.ContainsKey("transactions"))
                {
                    foreach (var transaction in block["transactions"])
                    {
                        if (cachedTrx.Contains(transaction["transactionHash"].ToString()))
                        {
                            continue;
                        }

                        string address = "";
                        float  desired_transfer_amount = 0;
                        if ((float)transaction["amount"] < 0)
                        {
                            desired_transfer_amount = ((float)transaction["amount"] + (float)transaction["fee"]) * -1;
                        }
                        else
                        {
                            desired_transfer_amount = ((float)transaction["amount"]);
                        }

                        foreach (var transfer in transaction["transfers"])
                        {
                            if ((float)transfer["amount"] == desired_transfer_amount)
                            {
                                address = transfer["address"].ToString();
                            }
                        }

                        List <ListViewItem.ListViewSubItem> subitems = new List <ListViewItem.ListViewSubItem>();

                        var txTransactionHash = transaction["transactionHash"].ToString();

                        if ((long)transaction["unlockTime"] == 0 || (long)transaction["unlockTime"] <= (long)status["blockCount"] - 40)
                        {
                            var confirmItem = new System.Windows.Forms.ListViewItem.ListViewSubItem(null, "  🐢  ✔", System.Drawing.Color.Green, System.Drawing.Color.FromArgb(((int)(((byte)(29)))), ((int)(((byte)(29)))), ((int)(((byte)(29))))), new System.Drawing.Font("Segoe UI Semibold", 13.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))));
                            subitems.Add(confirmItem);
                        }
                        else
                        {
                            var confirmItem = new System.Windows.Forms.ListViewItem.ListViewSubItem(null, "  🐢  ✘", System.Drawing.Color.DarkRed, System.Drawing.Color.FromArgb(((int)(((byte)(29)))), ((int)(((byte)(29)))), ((int)(((byte)(29))))), new System.Drawing.Font("Segoe UI Semibold", 13.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))));
                            subitems.Add(confirmItem);
                        }

                        if ((float)transaction["amount"] > 0)
                        {
                            var directionItem = new System.Windows.Forms.ListViewItem.ListViewSubItem(null, "IN\u2007\u2007⇚\u2007\u2007\u2007", System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0))))), System.Drawing.Color.FromArgb(((int)(((byte)(29)))), ((int)(((byte)(29)))), ((int)(((byte)(29))))), new System.Drawing.Font("Segoe UI Semibold", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))));
                            subitems.Add(directionItem);
                        }
                        else
                        {
                            var directionItem = new System.Windows.Forms.ListViewItem.ListViewSubItem(null, "OUT ⇛\u2007\u2007\u2007", System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0))))), System.Drawing.Color.FromArgb(((int)(((byte)(29)))), ((int)(((byte)(29)))), ((int)(((byte)(29))))), new System.Drawing.Font("Segoe UI Semibold", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))));
                            subitems.Add(directionItem);
                        }

                        var amountItem = new System.Windows.Forms.ListViewItem.ListViewSubItem(null, ((float)(transaction["amount"]) / 100).ToString("0.00"), System.Drawing.Color.White, System.Drawing.Color.FromArgb(((int)(((byte)(29)))), ((int)(((byte)(29)))), ((int)(((byte)(29))))), new System.Drawing.Font("Segoe UI Semibold", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))));
                        subitems.Add(amountItem);

                        System.DateTime dtDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, System.DateTimeKind.Utc);
                        dtDateTime = dtDateTime.AddSeconds((long)(transaction["timestamp"])).ToLocalTime();
                        var ts       = dtDateTime.ToString("yyyy/MM/dd HH:mm:ss tt");
                        var dateItem = new System.Windows.Forms.ListViewItem.ListViewSubItem(null, ts, System.Drawing.Color.White, System.Drawing.Color.FromArgb(((int)(((byte)(29)))), ((int)(((byte)(29)))), ((int)(((byte)(29))))), new System.Drawing.Font("Segoe UI Semibold", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))));
                        subitems.Add(dateItem);

                        var addItem = new System.Windows.Forms.ListViewItem.ListViewSubItem(null, txTransactionHash, System.Drawing.Color.White, System.Drawing.Color.FromArgb(((int)(((byte)(29)))), ((int)(((byte)(29)))), ((int)(((byte)(29))))), new System.Drawing.Font("Segoe UI Semibold", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))));
                        subitems.Add(addItem);

                        System.Windows.Forms.ListViewItem trxItem = new System.Windows.Forms.ListViewItem(subitems.ToArray(), -1)
                        {
                            UseItemStyleForSubItems = false
                        };

                        if (globalRefreshCount > 1)
                        {
                            txList.BeginInvoke((MethodInvoker) delegate()
                            {
                                txList.Items.Insert(0, trxItem);
                            });
                        }
                        else
                        {
                            firstRunTrx.Add(trxItem);
                        }

                        cachedTrx.Add(transaction["transactionHash"].ToString());
                        _trxFound = true;
                        windowLogger.Log(LogTextbox, "Found transaction " + transaction["transactionHash"].ToString() + ". Added to list ...");
                    }
                }
            }

            if (globalRefreshCount == 1)
            {
                txList.BeginInvoke((MethodInvoker) delegate()
                {
                    txList.Items.AddRange(firstRunTrx.ToArray());
                });
            }

            if (_trxFound)
            {
                foreach (ColumnHeader column in txList.Columns)
                {
                    column.Width = -2;
                }
            }

            string titleUpdate = "TurtleCoin Wallet - Network Sync [" + status["blockCount"].ToString() + " / " + status["knownBlockCount"].ToString() + "] | Peers: " + status["peerCount"].ToString() + " | Updated: " + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss tt");

            this.BeginInvoke((MethodInvoker) delegate()
            {
                this.Text = titleUpdate;
                this.Update();
            });
        }
Example #12
0
 private void UpdateWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     Utilities.Close(this);
 }
        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;
            }
        }
Example #14
0
        private void CreateWallet()
        {
            var curDir      = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
            var _walletFile = System.IO.Path.Combine(curDir, walletNameText.Text + ".wallet");

            if (walletNameText.Text == "")
            {
                MessageBox.Show("Please enter a valid wallet name", "Turtle Wallet Creation");
                return;
            }
            else if (walletNameText.Text.Any(c => !Char.IsLetterOrDigit(c)))
            {
                MessageBox.Show("Wallet name cannot contain special characters", "Turtle Wallet Creation");
                return;
            }
            else if (System.IO.File.Exists(_walletFile))
            {
                MessageBox.Show("A wallet with that name already exists! Choose a different name or choose the \"Select Existing Wallet\" option instead.", "Turtle Wallet Creation");
                return;
            }

            if (passwordText.Text == "")
            {
                MessageBox.Show("Please enter a valid password", "Turtle Wallet Creation");
                return;
            }
            else if (passwordText.Text.Length < 6)
            {
                MessageBox.Show("Please enter a password that is larger than 6 characters", "Turtle Wallet Creation");
                return;
            }

            if (passwordText.Text != passwordConfirmText.Text)
            {
                MessageBox.Show("Passwords do not match", "Turtle Wallet Creation");
                return;
            }

            var walletdexe = System.IO.Path.Combine(curDir, "walletd.exe");

            if (IsRunningOnMono())
            {
                walletdexe = System.IO.Path.Combine(curDir, "walletd");
            }

            if (!System.IO.File.Exists(walletdexe))
            {
                MessageBox.Show("The 'walletd' daemon is missing from the folder the wallet is currently running from! Please place 'walletd' next to your wallet exe and run again!", "Turtle Wallet Creation", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.DialogResult = DialogResult.Abort;
                Utilities.Close(this);
            }

            createProgressbar.Visible = true;
            StringBuilder tmpstdout = new StringBuilder();

            try
            {
                Process p = new Process();
                p.StartInfo.UseShellExecute        = false;
                p.StartInfo.RedirectStandardOutput = true;
                p.StartInfo.CreateNoWindow         = true;
                p.StartInfo.WindowStyle            = ProcessWindowStyle.Hidden;
                p.StartInfo.FileName  = walletdexe;
                p.StartInfo.Arguments = CLIEncoder.Encode(new string[] { "-w", _walletFile, "-p", passwordText.Text, "-g" });
                p.OutputDataReceived += (sender, args) => tmpstdout.AppendLine(args.Data);
                p.Start();
                p.BeginOutputReadLine();
                p.WaitForExit(10000);
                p.CancelOutputRead();

                if (!System.IO.File.Exists(_walletFile))
                {
                    MessageBox.Show("Wallet failed to create after communicating with daemon. Please reinstall the wallet, close any other wallets you may have open, and try again", "Turtle Wallet Creation", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    this.DialogResult = DialogResult.Abort;
                    Utilities.Close(this);
                }
                else
                {
                    WalletPath     = _walletFile;
                    WalletPassword = passwordText.Text;
                    MessageBox.Show("Wallet successfully created at: " + Environment.NewLine + _walletFile + Environment.NewLine + "IMPORTANT:" + Environment.NewLine + "As soon as the main GUI to the wallet opens, you should proceed to the 'BACKUP KEYS' tab to save your secret and view key in case of wallet failure in the future!", "Turtle Wallet Creation", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    Utilities.SetAppClosing(false);
                    this.DialogResult = DialogResult.OK;
                    Utilities.Close(this);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("An exception occured while attempting to create the wallet." + Environment.NewLine + "Error:" + Environment.NewLine + ex.Message, "Turtle Wallet Creation", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.DialogResult = DialogResult.Abort;
                Utilities.Close(this);
            }
        }
Example #15
0
        private void ImportWallet()
        {
            var curDir      = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
            var _walletFile = System.IO.Path.Combine(curDir, walletNameText.Text + ".wallet");

            if (walletNameText.Text == "")
            {
                MessageBox.Show("Please enter a valid wallet name", "bitcoin nova Wallet Import");
                return;
            }
            else if (walletNameText.Text.Any(c => !Char.IsLetterOrDigit(c)))
            {
                MessageBox.Show("Wallet name cannot contain special characters", "bitcoin nova Wallet Import");
                return;
            }
            else if (System.IO.File.Exists(_walletFile))
            {
                MessageBox.Show("A wallet with that name already exists! Choose a different name or choose the \"Select Existing Wallet\" option instead.", "bitcoin nova Wallet Import");
                return;
            }

            if (passwordText.Text == "")
            {
                MessageBox.Show("Please enter a valid password", "bitcoin nova Wallet Import");
                return;
            }
            else if (passwordText.Text.Length < 6)
            {
                MessageBox.Show("Please enter a password that is larger than 6 characters", "bitcoin nova Wallet Import");
                return;
            }
            else if (passwordText.Text.Length > 150)
            {
                MessageBox.Show("Passwords cannot be longer than 150 characters!", "bitcoin nova Wallet Import");
                return;
            }

            if (passwordText.Text != passwordConfirmText.Text)
            {
                MessageBox.Show("Passwords do not match", "bitcoin nova Wallet Import");
                return;
            }

            if (viewSecretKeyText.Text.Length != 64 || spendSecretKeyText.Text.Length != 64)
            {
                MessageBox.Show("View key or spend key is incorrect length! Should be 64 characters long.", "bitcoin nova Wallet Import");
                return;
            }

            var walletdexe = System.IO.Path.Combine(curDir, "walletd.exe");

            if (IsRunningOnMono())
            {
                walletdexe = System.IO.Path.Combine(curDir, "walletd");
            }

            if (!System.IO.File.Exists(walletdexe))
            {
                MessageBox.Show("The 'walletd' daemon is missing from the folder the wallet is currently running from! Please place 'walletd' next to your wallet exe and run again!", "bitcoin nova Wallet Import", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Utilities.SetDialogResult(this, DialogResult.Abort);
                Utilities.Close(this);
            }

            importProgressbar.Visible = true;
            StringBuilder tmpstdout = new StringBuilder();

            try
            {
                Process p = new Process();
                p.StartInfo.UseShellExecute        = false;
                p.StartInfo.RedirectStandardOutput = true;
                p.StartInfo.CreateNoWindow         = true;
                p.StartInfo.WindowStyle            = ProcessWindowStyle.Hidden;
                p.StartInfo.FileName = walletdexe;

                p.StartInfo.Arguments = CLIEncoder.Encode(new string[]
                                                          { "-w", _walletFile, "-p", passwordText.Text, "--view-key",
                                                            viewSecretKeyText.Text, "--spend-key", spendSecretKeyText.Text,
                                                            "-g" });

                p.OutputDataReceived += (sender, args) => tmpstdout.AppendLine(args.Data);
                p.Start();
                p.BeginOutputReadLine();
                p.WaitForExit(10000);
                p.CancelOutputRead();

                if (!System.IO.File.Exists(_walletFile))
                {
                    MessageBox.Show("Wallet failed to import after communicating with daemon. Please ensure your secret keys are correct, and open walletd.log for more information on what went wrong, if it exists.", "bitcoin nova Wallet Import", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Utilities.SetDialogResult(this, DialogResult.Abort);
                    Utilities.Close(this);
                }
                else
                {
                    ImportWalletPath     = _walletFile;
                    ImportWalletPassword = passwordText.Text;
                    MessageBox.Show("Wallet successfully imported at: " + Environment.NewLine + _walletFile, "bitcoin nova Wallet Import", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    Utilities.SetDialogResult(this, DialogResult.OK);
                    Utilities.Close(this);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("An exception occured while attempting to import the wallet." + Environment.NewLine + "Error:" + Environment.NewLine + ex.Message, "bitcoin nova Wallet Import", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Utilities.SetDialogResult(this, DialogResult.Abort);
                Utilities.Close(this);
            }
        }
Example #16
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;
            }
        }
 private void CreateWalletButton_Click(object sender, EventArgs e)
 {
     WalletPassword = passwordText.Text;
     Utilities.SetDialogResult(this, DialogResult.OK);
     Utilities.Close(this);
 }