mirror of
https://github.com/Nathanwoodburn/FireWallet.git
synced 2024-11-10 09:18:15 +11:00
main: Added bug fixes for new installs
This commit is contained in:
parent
92bef9ef5d
commit
7388710704
3
FireWallet/MainForm.Designer.cs
generated
3
FireWallet/MainForm.Designer.cs
generated
@ -964,16 +964,17 @@ namespace FireWallet
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1152, 575);
|
||||
Controls.Add(panelaccount);
|
||||
Controls.Add(panelRecieve);
|
||||
Controls.Add(panelSettings);
|
||||
Controls.Add(panelDomains);
|
||||
Controls.Add(panelSend);
|
||||
Controls.Add(panelPortfolio);
|
||||
Controls.Add(panelNav);
|
||||
Controls.Add(panelaccount);
|
||||
Controls.Add(statusStripmain);
|
||||
Icon = (Icon)resources.GetObject("$this.Icon");
|
||||
Name = "MainForm";
|
||||
Opacity = 0D;
|
||||
Text = "FireWallet";
|
||||
FormClosing += MainForm_Closing;
|
||||
Load += MainForm_Load;
|
||||
|
@ -39,15 +39,16 @@ namespace FireWallet
|
||||
public MainForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
panelaccount.Visible = true;
|
||||
}
|
||||
private void MainForm_Load(object sender, EventArgs e)
|
||||
private async void MainForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
watchOnly = false;
|
||||
account = "";
|
||||
timerNodeStatus.Stop();
|
||||
LoadSettings();
|
||||
UpdateTheme();
|
||||
LoadNode();
|
||||
if (await LoadNode() != true) this.Close();
|
||||
|
||||
if (userSettings.ContainsKey("hide-splash"))
|
||||
{
|
||||
@ -59,6 +60,13 @@ namespace FireWallet
|
||||
ss.Dispose();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Show splash screen
|
||||
SplashScreen ss = new SplashScreen();
|
||||
ss.ShowDialog();
|
||||
ss.Dispose();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -79,16 +87,16 @@ namespace FireWallet
|
||||
GetAccounts();
|
||||
|
||||
AddLog("Loaded");
|
||||
Opacity = 1;
|
||||
batchMode = false;
|
||||
textBoxaccountpassword.Focus();
|
||||
timerNodeStatus.Start();
|
||||
}
|
||||
private void MainForm_Closing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
AddLog("Closing");
|
||||
if (hsdProcess != null)
|
||||
{
|
||||
this.Hide();
|
||||
this.Opacity = 0;
|
||||
hsdProcess.Kill();
|
||||
AddLog("HSD Closed");
|
||||
Thread.Sleep(1000);
|
||||
@ -109,7 +117,7 @@ namespace FireWallet
|
||||
|
||||
|
||||
#region Settings
|
||||
private async void LoadNode()
|
||||
private async Task<bool> LoadNode()
|
||||
{
|
||||
HSD = false;
|
||||
if (!File.Exists(dir + "node.txt"))
|
||||
@ -123,7 +131,8 @@ namespace FireWallet
|
||||
{
|
||||
AddLog("Node setup failed");
|
||||
this.Close();
|
||||
return;
|
||||
await Task.Delay(1000);
|
||||
AddLog("Close Failed");
|
||||
}
|
||||
|
||||
StreamReader sr = new StreamReader(dir + "node.txt");
|
||||
@ -141,7 +150,8 @@ namespace FireWallet
|
||||
{
|
||||
AddLog("Node Settings file is missing key");
|
||||
this.Close();
|
||||
return;
|
||||
await Task.Delay(1000);
|
||||
AddLog("Close Failed");
|
||||
}
|
||||
network = Convert.ToInt32(nodeSettings["Network"]);
|
||||
switch (network)
|
||||
@ -181,7 +191,17 @@ namespace FireWallet
|
||||
}
|
||||
hsdProcess = new Process();
|
||||
|
||||
hsdProcess.StartInfo.CreateNoWindow = true;
|
||||
bool hideScreen = true;
|
||||
if (nodeSettings.ContainsKey("HideScreen"))
|
||||
{
|
||||
if (nodeSettings["HideScreen"].ToLower() == "false")
|
||||
{
|
||||
hideScreen = false;
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
hsdProcess.StartInfo.CreateNoWindow = hideScreen;
|
||||
|
||||
hsdProcess.StartInfo.RedirectStandardInput = true;
|
||||
hsdProcess.StartInfo.RedirectStandardOutput = false;
|
||||
@ -196,18 +216,27 @@ namespace FireWallet
|
||||
hsdProcess.StartInfo.Arguments = hsdProcess.StartInfo.Arguments + " --prefix " + bobPath;
|
||||
}
|
||||
hsdProcess.Start();
|
||||
|
||||
|
||||
// Wait for HSD to start
|
||||
await Task.Delay(2000);
|
||||
} catch (Exception ex)
|
||||
{
|
||||
AddLog("HSD Failed to start");
|
||||
AddLog(ex.Message);
|
||||
this.Close();
|
||||
await Task.Delay(1000);
|
||||
AddLog("Close Failed");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
timerNodeStatus.Start();
|
||||
NodeStatus();
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
private void LoadSettings()
|
||||
{
|
||||
if (!Directory.Exists(dir)) Directory.CreateDirectory(dir);
|
||||
if (!File.Exists(dir + "settings.txt"))
|
||||
{
|
||||
AddLog("Creating settings file");
|
||||
@ -454,6 +483,8 @@ namespace FireWallet
|
||||
GetAccounts();
|
||||
}
|
||||
private async void GetAccounts()
|
||||
{
|
||||
try
|
||||
{
|
||||
string APIresponse = await APIGet("wallet", true);
|
||||
comboBoxaccount.Items.Clear();
|
||||
@ -481,6 +512,11 @@ namespace FireWallet
|
||||
comboBoxaccount.Enabled = false;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
AddLog("Error getting accounts");
|
||||
}
|
||||
}
|
||||
private async Task<bool> Login()
|
||||
{
|
||||
string path = "wallet/" + account + "/unlock";
|
||||
@ -676,6 +712,8 @@ namespace FireWallet
|
||||
/// <returns></returns>
|
||||
public async Task<string> APIGet(string path, bool wallet)
|
||||
{
|
||||
if (nodeSettings == null) return "Error";
|
||||
if (!nodeSettings.ContainsKey("Key") || !nodeSettings.ContainsKey("IP")) return "Error";
|
||||
string key = nodeSettings["Key"];
|
||||
string ip = nodeSettings["IP"];
|
||||
|
||||
@ -1234,12 +1272,21 @@ namespace FireWallet
|
||||
{
|
||||
try
|
||||
{
|
||||
bool hideScreen = true;
|
||||
if (nodeSettings.ContainsKey("HideScreen"))
|
||||
{
|
||||
if (nodeSettings["HideScreen"].ToLower() == "false")
|
||||
{
|
||||
hideScreen = false;
|
||||
}
|
||||
}
|
||||
|
||||
ProcessStartInfo startInfo = new ProcessStartInfo();
|
||||
startInfo.FileName = "git";
|
||||
startInfo.Arguments = $"clone {repositoryUrl} {destinationPath}";
|
||||
startInfo.RedirectStandardOutput = true;
|
||||
startInfo.UseShellExecute = false;
|
||||
startInfo.CreateNoWindow = true;
|
||||
startInfo.CreateNoWindow = hideScreen;
|
||||
|
||||
Process process = new Process();
|
||||
process.StartInfo = startInfo;
|
||||
@ -1257,7 +1304,7 @@ namespace FireWallet
|
||||
FileName = "cmd",
|
||||
RedirectStandardInput = true,
|
||||
WorkingDirectory = destinationPath,
|
||||
CreateNoWindow = true
|
||||
CreateNoWindow = hideScreen
|
||||
};
|
||||
var pNpmRunDist = Process.Start(psiNpmRunDist);
|
||||
pNpmRunDist.StandardInput.WriteLine("npm install & exit");
|
||||
|
@ -27,10 +27,7 @@ namespace FireWallet
|
||||
|
||||
private void SplashScreen_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
if (!close)
|
||||
{
|
||||
e.Cancel = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void label2_Click(object sender, EventArgs e)
|
||||
|
Loading…
Reference in New Issue
Block a user