main: Code cleanup
This commit is contained in:
@@ -1,59 +1,56 @@
|
||||
using FireWallet;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace FireWalletLite
|
||||
namespace FireWalletLite;
|
||||
|
||||
public partial class FirstLoginForm : Form
|
||||
{
|
||||
public partial class FirstLoginForm : Form
|
||||
private readonly MainForm main;
|
||||
private string seedPhrase;
|
||||
|
||||
public FirstLoginForm(string seedPhrase, MainForm mainForm)
|
||||
{
|
||||
String seedPhrase;
|
||||
MainForm main;
|
||||
public FirstLoginForm(string seedPhrase, MainForm mainForm)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.seedPhrase = seedPhrase;
|
||||
this.main = mainForm;
|
||||
// Theme form
|
||||
this.BackColor = ColorTranslator.FromHtml(mainForm.Theme["background"]);
|
||||
this.ForeColor = ColorTranslator.FromHtml(mainForm.Theme["foreground"]);
|
||||
foreach (Control control in Controls)
|
||||
{
|
||||
mainForm.ThemeControl(control);
|
||||
}
|
||||
textBoxSeed.Text = seedPhrase;
|
||||
}
|
||||
|
||||
private async void Start_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (textBoxPassword.Text.Length < 8)
|
||||
{
|
||||
NotifyForm notifyForm = new NotifyForm("Please choose a longer password!");
|
||||
notifyForm.ShowDialog();
|
||||
notifyForm.Dispose();
|
||||
return;
|
||||
}
|
||||
if (textBoxPassword.Text != textBoxPassword2.Text)
|
||||
{
|
||||
NotifyForm notifyForm = new NotifyForm("Passwords do not match!");
|
||||
notifyForm.ShowDialog();
|
||||
notifyForm.Dispose();
|
||||
return;
|
||||
}
|
||||
|
||||
// Encrypt wallet
|
||||
string content = "{\"method\":\"encryptwallet\",\"params\":[\"" + textBoxPassword.Text + "\"]}";
|
||||
string response = await main.APIPost("",true,content);
|
||||
main.AddLog("Encrypt wallet: " + response);
|
||||
JObject jObject = JObject.Parse(response);
|
||||
if (jObject["error"].ToString() != "")
|
||||
{
|
||||
NotifyForm notifyForm = new NotifyForm("Error encrypting wallet: " + jObject["error"].ToString());
|
||||
notifyForm.ShowDialog();
|
||||
notifyForm.Dispose();
|
||||
return;
|
||||
} else
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
InitializeComponent();
|
||||
this.seedPhrase = seedPhrase;
|
||||
main = mainForm;
|
||||
// Theme form
|
||||
BackColor = ColorTranslator.FromHtml(mainForm.Theme["background"]);
|
||||
ForeColor = ColorTranslator.FromHtml(mainForm.Theme["foreground"]);
|
||||
foreach (Control control in Controls) mainForm.ThemeControl(control);
|
||||
textBoxSeed.Text = seedPhrase;
|
||||
}
|
||||
}
|
||||
|
||||
private async void Start_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (textBoxPassword.Text.Length < 8)
|
||||
{
|
||||
var notifyForm = new NotifyForm("Please choose a longer password!");
|
||||
notifyForm.ShowDialog();
|
||||
notifyForm.Dispose();
|
||||
return;
|
||||
}
|
||||
|
||||
if (textBoxPassword.Text != textBoxPassword2.Text)
|
||||
{
|
||||
var notifyForm = new NotifyForm("Passwords do not match!");
|
||||
notifyForm.ShowDialog();
|
||||
notifyForm.Dispose();
|
||||
return;
|
||||
}
|
||||
|
||||
// Encrypt wallet
|
||||
var content = "{\"method\":\"encryptwallet\",\"params\":[\"" + textBoxPassword.Text + "\"]}";
|
||||
var response = await main.APIPost("", true, content);
|
||||
main.AddLog("Encrypt wallet: " + response);
|
||||
var jObject = JObject.Parse(response);
|
||||
if (jObject["error"].ToString() != "")
|
||||
{
|
||||
var notifyForm = new NotifyForm("Error encrypting wallet: " + jObject["error"]);
|
||||
notifyForm.ShowDialog();
|
||||
notifyForm.Dispose();
|
||||
return;
|
||||
}
|
||||
|
||||
Close();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user