main: Cleaned up code

This commit is contained in:
Nathan Woodburn 2023-06-08 18:19:39 +10:00
parent b03bcd3f2c
commit 9296f37475
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1
2 changed files with 75 additions and 31 deletions

View File

@ -101,6 +101,10 @@ namespace FireWallet
textBoxExAddr = new TextBox(); textBoxExAddr = new TextBox();
labelSettings4 = new Label(); labelSettings4 = new Label();
textBoxExTX = new TextBox(); textBoxExTX = new TextBox();
groupBoxSettingsMisc = new GroupBox();
labelSettings5 = new Label();
numericUpDownConfirmations = new NumericUpDown();
labelSettings6 = new Label();
statusStripmain.SuspendLayout(); statusStripmain.SuspendLayout();
panelaccount.SuspendLayout(); panelaccount.SuspendLayout();
groupBoxaccount.SuspendLayout(); groupBoxaccount.SuspendLayout();
@ -115,6 +119,8 @@ namespace FireWallet
groupBoxDomains.SuspendLayout(); groupBoxDomains.SuspendLayout();
panelSettings.SuspendLayout(); panelSettings.SuspendLayout();
groupBoxSettingsExplorer.SuspendLayout(); groupBoxSettingsExplorer.SuspendLayout();
groupBoxSettingsMisc.SuspendLayout();
((System.ComponentModel.ISupportInitialize)numericUpDownConfirmations).BeginInit();
SuspendLayout(); SuspendLayout();
// //
// statusStripmain // statusStripmain
@ -705,6 +711,7 @@ namespace FireWallet
// //
// panelSettings // panelSettings
// //
panelSettings.Controls.Add(groupBoxSettingsMisc);
panelSettings.Controls.Add(labelSettingsSaved); panelSettings.Controls.Add(labelSettingsSaved);
panelSettings.Controls.Add(buttonSettingsSave); panelSettings.Controls.Add(buttonSettingsSave);
panelSettings.Controls.Add(groupBoxSettingsExplorer); panelSettings.Controls.Add(groupBoxSettingsExplorer);
@ -819,6 +826,44 @@ namespace FireWallet
textBoxExTX.Size = new Size(307, 29); textBoxExTX.Size = new Size(307, 29);
textBoxExTX.TabIndex = 1; textBoxExTX.TabIndex = 1;
// //
// groupBoxSettingsMisc
//
groupBoxSettingsMisc.Controls.Add(labelSettings6);
groupBoxSettingsMisc.Controls.Add(numericUpDownConfirmations);
groupBoxSettingsMisc.Controls.Add(labelSettings5);
groupBoxSettingsMisc.Location = new Point(14, 210);
groupBoxSettingsMisc.Name = "groupBoxSettingsMisc";
groupBoxSettingsMisc.Size = new Size(487, 194);
groupBoxSettingsMisc.TabIndex = 7;
groupBoxSettingsMisc.TabStop = false;
groupBoxSettingsMisc.Text = "Misc Settings";
//
// labelSettings5
//
labelSettings5.AutoSize = true;
labelSettings5.Location = new Point(11, 36);
labelSettings5.Name = "labelSettings5";
labelSettings5.Size = new Size(112, 21);
labelSettings5.TabIndex = 0;
labelSettings5.Text = "Confirmations:";
//
// numericUpDown1
//
numericUpDownConfirmations.Location = new Point(129, 34);
numericUpDownConfirmations.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
numericUpDownConfirmations.Name = "numericUpDown1";
numericUpDownConfirmations.Size = new Size(120, 29);
numericUpDownConfirmations.TabIndex = 1;
//
// labelSettings6
//
labelSettings6.AutoSize = true;
labelSettings6.Location = new Point(255, 36);
labelSettings6.Name = "labelSettings6";
labelSettings6.Size = new Size(54, 21);
labelSettings6.TabIndex = 2;
labelSettings6.Text = "blocks";
//
// MainForm // MainForm
// //
AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleDimensions = new SizeF(7F, 15F);
@ -861,6 +906,9 @@ namespace FireWallet
panelSettings.PerformLayout(); panelSettings.PerformLayout();
groupBoxSettingsExplorer.ResumeLayout(false); groupBoxSettingsExplorer.ResumeLayout(false);
groupBoxSettingsExplorer.PerformLayout(); groupBoxSettingsExplorer.PerformLayout();
groupBoxSettingsMisc.ResumeLayout(false);
groupBoxSettingsMisc.PerformLayout();
((System.ComponentModel.ISupportInitialize)numericUpDownConfirmations).EndInit();
ResumeLayout(false); ResumeLayout(false);
PerformLayout(); PerformLayout();
} }
@ -933,5 +981,9 @@ namespace FireWallet
private Button buttonSettingsSave; private Button buttonSettingsSave;
private GroupBox groupBoxSettingsExplorer; private GroupBox groupBoxSettingsExplorer;
private Label labelSettingsSaved; private Label labelSettingsSaved;
private GroupBox groupBoxSettingsMisc;
private Label labelSettings6;
private NumericUpDown numericUpDownConfirmations;
private Label labelSettings5;
} }
} }

View File

@ -228,7 +228,8 @@ namespace FireWallet
} }
} }
if (c.GetType() == typeof(TextBox) || c.GetType() == typeof(Button) if (c.GetType() == typeof(TextBox) || c.GetType() == typeof(Button)
|| c.GetType() == typeof(ComboBox) || c.GetType() == typeof(StatusStrip) || c.GetType() == typeof(ToolStrip)) || c.GetType() == typeof(ComboBox) || c.GetType() == typeof(StatusStrip) || c.GetType() == typeof(ToolStrip)
|| c.GetType() == typeof(NumericUpDown))
{ {
c.ForeColor = ColorTranslator.FromHtml(theme["foreground-alt"]); c.ForeColor = ColorTranslator.FromHtml(theme["foreground-alt"]);
c.BackColor = ColorTranslator.FromHtml(theme["background-alt"]); c.BackColor = ColorTranslator.FromHtml(theme["background-alt"]);
@ -772,16 +773,8 @@ namespace FireWallet
#region Nav #region Nav
private async void PortfolioPanel_Click(object sender, EventArgs e) private async void PortfolioPanel_Click(object sender, EventArgs e)
{ {
panelSend.Hide(); hidePages();
panelPortfolio.Show();
panelRecieve.Hide();
panelDomains.Hide();
buttonNavSend.BackColor = ColorTranslator.FromHtml(theme["background"]);
buttonNavSend.ForeColor = ColorTranslator.FromHtml(theme["foreground"]);
buttonNavReceive.BackColor = ColorTranslator.FromHtml(theme["background"]);
buttonNavReceive.ForeColor = ColorTranslator.FromHtml(theme["foreground"]);
buttonNavDomains.BackColor = ColorTranslator.FromHtml(theme["background"]);
buttonNavDomains.ForeColor = ColorTranslator.FromHtml(theme["foreground"]);
await UpdateBalance(); await UpdateBalance();
GetTXHistory(); GetTXHistory();
labelBalance.Text = "Available: " + balance.ToString() + " HNS"; labelBalance.Text = "Available: " + balance.ToString() + " HNS";
@ -798,12 +791,6 @@ namespace FireWallet
{ {
hidePages(); hidePages();
panelSend.Show(); panelSend.Show();
buttonNavPortfolio.BackColor = ColorTranslator.FromHtml(theme["background"]);
buttonNavPortfolio.ForeColor = ColorTranslator.FromHtml(theme["foreground"]);
buttonNavReceive.BackColor = ColorTranslator.FromHtml(theme["background"]);
buttonNavReceive.ForeColor = ColorTranslator.FromHtml(theme["foreground"]);
buttonNavDomains.BackColor = ColorTranslator.FromHtml(theme["background"]);
buttonNavDomains.ForeColor = ColorTranslator.FromHtml(theme["foreground"]);
if (theme.ContainsKey("selected-bg") && theme.ContainsKey("selected-fg")) if (theme.ContainsKey("selected-bg") && theme.ContainsKey("selected-fg"))
{ {
buttonNavSend.BackColor = ColorTranslator.FromHtml(theme["selected-bg"]); buttonNavSend.BackColor = ColorTranslator.FromHtml(theme["selected-bg"]);
@ -837,12 +824,6 @@ namespace FireWallet
{ {
hidePages(); hidePages();
panelRecieve.Show(); panelRecieve.Show();
buttonNavSend.BackColor = ColorTranslator.FromHtml(theme["background"]);
buttonNavSend.ForeColor = ColorTranslator.FromHtml(theme["foreground"]);
buttonNavPortfolio.BackColor = ColorTranslator.FromHtml(theme["background"]);
buttonNavPortfolio.ForeColor = ColorTranslator.FromHtml(theme["foreground"]);
buttonNavDomains.BackColor = ColorTranslator.FromHtml(theme["background"]);
buttonNavDomains.ForeColor = ColorTranslator.FromHtml(theme["foreground"]);
if (theme.ContainsKey("selected-bg") && theme.ContainsKey("selected-fg")) if (theme.ContainsKey("selected-bg") && theme.ContainsKey("selected-fg"))
{ {
@ -877,13 +858,6 @@ namespace FireWallet
hidePages(); hidePages();
panelDomains.Show(); panelDomains.Show();
buttonNavSend.BackColor = ColorTranslator.FromHtml(theme["background"]);
buttonNavSend.ForeColor = ColorTranslator.FromHtml(theme["foreground"]);
buttonNavPortfolio.BackColor = ColorTranslator.FromHtml(theme["background"]);
buttonNavPortfolio.ForeColor = ColorTranslator.FromHtml(theme["foreground"]);
buttonNavReceive.BackColor = ColorTranslator.FromHtml(theme["background"]);
buttonNavReceive.ForeColor = ColorTranslator.FromHtml(theme["foreground"]);
if (theme.ContainsKey("selected-bg") && theme.ContainsKey("selected-fg")) if (theme.ContainsKey("selected-bg") && theme.ContainsKey("selected-fg"))
{ {
buttonNavDomains.BackColor = ColorTranslator.FromHtml(theme["selected-bg"]); buttonNavDomains.BackColor = ColorTranslator.FromHtml(theme["selected-bg"]);
@ -903,16 +877,34 @@ namespace FireWallet
panelRecieve.Hide(); panelRecieve.Hide();
panelDomains.Hide(); panelDomains.Hide();
panelSettings.Hide(); panelSettings.Hide();
buttonNavPortfolio.BackColor = ColorTranslator.FromHtml(theme["background"]);
buttonNavPortfolio.ForeColor = ColorTranslator.FromHtml(theme["foreground"]);
buttonNavSend.BackColor = ColorTranslator.FromHtml(theme["background"]);
buttonNavSend.ForeColor = ColorTranslator.FromHtml(theme["foreground"]);
buttonNavReceive.BackColor = ColorTranslator.FromHtml(theme["background"]);
buttonNavReceive.ForeColor = ColorTranslator.FromHtml(theme["foreground"]);
buttonNavDomains.BackColor = ColorTranslator.FromHtml(theme["background"]);
buttonNavDomains.ForeColor = ColorTranslator.FromHtml(theme["foreground"]);
buttonNavSettings.BackColor = ColorTranslator.FromHtml(theme["background"]);
buttonNavSettings.ForeColor = ColorTranslator.FromHtml(theme["foreground"]);
} }
private void buttonNavSettings_Click(object sender, EventArgs e) private void buttonNavSettings_Click(object sender, EventArgs e)
{ {
hidePages(); hidePages();
if (theme.ContainsKey("selected-bg") && theme.ContainsKey("selected-fg"))
{
buttonNavSettings.BackColor = ColorTranslator.FromHtml(theme["selected-bg"]);
buttonNavSettings.ForeColor = ColorTranslator.FromHtml(theme["selected-fg"]);
}
panelSettings.Show(); panelSettings.Show();
buttonSettingsSave.Top = panelSettings.Height - buttonSettingsSave.Height - 10; buttonSettingsSave.Top = panelSettings.Height - buttonSettingsSave.Height - 10;
labelSettingsSaved.Top = buttonSettingsSave.Top + 10;
textBoxExTX.Text = userSettings["explorer-tx"]; textBoxExTX.Text = userSettings["explorer-tx"];
textBoxExAddr.Text = userSettings["explorer-addr"]; textBoxExAddr.Text = userSettings["explorer-addr"];
textBoxExBlock.Text = userSettings["explorer-block"]; textBoxExBlock.Text = userSettings["explorer-block"];
textBoxExName.Text = userSettings["explorer-domain"]; textBoxExName.Text = userSettings["explorer-domain"];
numericUpDownConfirmations.Value = int.Parse(userSettings["confirmations"]);
labelSettingsSaved.Hide(); labelSettingsSaved.Hide();
} }
#endregion #endregion
@ -1193,7 +1185,7 @@ namespace FireWallet
sw.WriteLine("explorer-block: " + textBoxExBlock.Text); sw.WriteLine("explorer-block: " + textBoxExBlock.Text);
sw.WriteLine("explorer-domain: " + textBoxExName.Text); sw.WriteLine("explorer-domain: " + textBoxExName.Text);
sw.WriteLine("confirmations: " + userSettings["confirmations"]); sw.WriteLine("confirmations: " + numericUpDownConfirmations.Value);
sw.WriteLine("portfolio-tx: " + userSettings["portfolio-tx"]); sw.WriteLine("portfolio-tx: " + userSettings["portfolio-tx"]);
sw.WriteLine("hide-splash: " + userSettings["hide-splash"]); sw.WriteLine("hide-splash: " + userSettings["hide-splash"]);
sw.Dispose(); sw.Dispose();