main: Fixed startup bugs

This commit is contained in:
Nathan Woodburn 2023-06-08 19:21:38 +10:00
parent 6daf6c5fe9
commit 9d0db3193c
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1

View File

@ -35,6 +35,7 @@ namespace FireWallet
} }
private void MainForm_Load(object sender, EventArgs e) private void MainForm_Load(object sender, EventArgs e)
{ {
account = "";
timerNodeStatus.Stop(); timerNodeStatus.Stop();
LoadSettings(); LoadSettings();
@ -71,7 +72,7 @@ namespace FireWallet
AddLog("Loaded"); AddLog("Loaded");
batchMode = false; batchMode = false;
textBoxaccountpassword.Focus();
timerNodeStatus.Start(); timerNodeStatus.Start();
} }
private void MainForm_Closing(object sender, FormClosingEventArgs e) private void MainForm_Closing(object sender, FormClosingEventArgs e)
@ -381,6 +382,7 @@ namespace FireWallet
comboBoxaccount.Items.Clear(); comboBoxaccount.Items.Clear();
if (APIresponse != "Error") if (APIresponse != "Error")
{ {
comboBoxaccount.Enabled = true;
JArray jArray = JArray.Parse(APIresponse); JArray jArray = JArray.Parse(APIresponse);
foreach (string account in jArray) foreach (string account in jArray)
{ {
@ -401,7 +403,6 @@ namespace FireWallet
comboBoxaccount.Items.Add("No accounts found"); comboBoxaccount.Items.Add("No accounts found");
comboBoxaccount.Enabled = false; comboBoxaccount.Enabled = false;
} }
textBoxaccountpassword.Focus();
} }
private async Task<bool> Login() private async Task<bool> Login()
{ {
@ -497,11 +498,14 @@ namespace FireWallet
if (await APIGet("", false) == "Error") if (await APIGet("", false) == "Error")
{ {
toolStripStatusLabelstatus.Text = "Status: Node Not Connected"; toolStripStatusLabelstatus.Text = "Status: Node Not Connected";
return;
} }
else else
{ {
if (toolStripStatusLabelstatus.Text != "Status: Node Connected") GetAccounts(); // Get accounts if node was not connected before
toolStripStatusLabelstatus.Text = "Status: Node Connected"; toolStripStatusLabelstatus.Text = "Status: Node Connected";
} }
if (account == "") return; // Don't update balance if not logged in
// Try to keep wallet unlocked // Try to keep wallet unlocked
string path = "wallet/" + account + "/unlock"; string path = "wallet/" + account + "/unlock";