main: Cleaned login panel

This commit is contained in:
Nathan Woodburn 2023-07-05 18:21:11 +10:00
parent 9e2a1c17d8
commit a19833d025
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1
4 changed files with 17 additions and 22 deletions

View File

@ -42,7 +42,10 @@
MinimizeBox = false;
Name = "Loader";
Text = "Loader";
Load += Loader_Load;
Visible = false;
Opacity = 0;
FormBorderStyle = FormBorderStyle.SizableToolWindow;
ShowInTaskbar = false;
ResumeLayout(false);
}

View File

@ -39,11 +39,7 @@ namespace FireWalletLite
string repositoryUrl = "https://github.com/handshake-org/hsd.git";
string destinationPath = dir + "hsd";
CloneRepository(repositoryUrl, destinationPath);
}
// Start HSD
HSDProcess.StartInfo.RedirectStandardInput = true;
HSDProcess.StartInfo.RedirectStandardOutput = false;
@ -70,15 +66,8 @@ namespace FireWalletLite
Application.DoEvents();
}
splashScreen.Dispose();
mainForm.Show();
}
private void Loader_Load(object sender, EventArgs e)
{
this.ShowInTaskbar = false;
this.Opacity = 0;
}
#region Git
public void CloneRepository(string repositoryUrl, string destinationPath)
{

View File

@ -71,8 +71,7 @@
panelLogin.Controls.Add(textBoxPassword);
panelLogin.Controls.Add(labelPassword);
panelLogin.Controls.Add(LoginButton);
panelLogin.Dock = DockStyle.Fill;
panelLogin.Location = new Point(0, 22);
panelLogin.Location = new Point(776, 443);
panelLogin.Name = "panelLogin";
panelLogin.Size = new Size(784, 428);
panelLogin.TabIndex = 1;
@ -95,6 +94,7 @@
textBoxPassword.Size = new Size(137, 29);
textBoxPassword.TabIndex = 2;
textBoxPassword.UseSystemPasswordChar = true;
textBoxPassword.KeyDown += textBoxPassword_KeyDown;
//
// labelPassword
//

View File

@ -206,8 +206,6 @@ namespace FireWalletLite
//req.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes("x:" + key)));
req.Content = new StringContent(content);
// Send request
try
{
HttpResponseMessage resp = await httpClient.SendAsync(req);
@ -237,7 +235,6 @@ namespace FireWalletLite
string port = "1203";
if (wallet) port = port + "9";
else port = port + "7";
try
{
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, "http://" + ip + ":" + port + "/" + path);
@ -266,7 +263,6 @@ namespace FireWalletLite
}
}
#endregion
private void MainForm_Load(object sender, EventArgs e)
{
LoginButton.Left = (this.ClientSize.Width - LoginButton.Width) / 2;
@ -292,7 +288,6 @@ namespace FireWalletLite
firstLoginForm.Dispose();
}
}
private async void Login_Click(object sender, EventArgs e)
{
LoginButton.Enabled = false; // To prevent double clicking
@ -302,17 +297,17 @@ namespace FireWalletLite
string content = "{\"passphrase\": \"" + Password + "\",\"timeout\": 60}";
string response = await APIPost(path, true, content);
if (response.Contains("Could not decrypt"))
if (response == "Error")
{
Password = "";
NotifyForm notifyForm = new NotifyForm("Incorrect Password");
notifyForm.ShowDialog();
notifyForm.Dispose();
LoginButton.Enabled = true;
return;
}
panelLogin.Hide();
}
private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
{
// Run taskkill /im "node.exe" /f /t
@ -322,7 +317,15 @@ namespace FireWalletLite
startInfo.CreateNoWindow = true;
Process.Start(startInfo);
Environment.Exit(0);
}
private void textBoxPassword_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyValue == 13)
{
Login_Click(sender, e);
e.SuppressKeyPress = true;
}
}
}
}