From 90cc614ebfc14e378a65618474ec634ceb98a921 Mon Sep 17 00:00:00 2001 From: Nathan Woodburn Date: Sat, 17 Jun 2023 13:47:47 +1000 Subject: [PATCH] main: Updated theme dropdown and added new menu item for other projects. - Changed foreach loop to update the foreground and background colors of ToolStripDropDownItems - Added a new menu item "Other Projects" to the Help dropdown menu - Created a new event handler method for the "Other Projects" menu item click action --- FireWallet/MainForm.Designer.cs | 36 +++++++++++++------ FireWallet/MainForm.cs | 61 ++++++++++++++++++++------------- 2 files changed, 63 insertions(+), 34 deletions(-) diff --git a/FireWallet/MainForm.Designer.cs b/FireWallet/MainForm.Designer.cs index 2e25f73..5ee2c67 100644 --- a/FireWallet/MainForm.Designer.cs +++ b/FireWallet/MainForm.Designer.cs @@ -95,6 +95,7 @@ namespace FireWallet textBoxReceiveAddress = new TextBox(); labelReceive1 = new Label(); panelDomains = new Panel(); + labelDomainSort = new Label(); comboBoxDomainSort = new ComboBox(); buttonExportDomains = new Button(); groupBoxDomains = new GroupBox(); @@ -123,7 +124,8 @@ namespace FireWallet textBoxExAddr = new TextBox(); labelSettings4 = new Label(); textBoxExTX = new TextBox(); - labelDomainSort = new Label(); + toolStripSeparator1 = new ToolStripSeparator(); + otherProjectsToolStripMenuItem = new ToolStripMenuItem(); statusStripmain.SuspendLayout(); panelaccount.SuspendLayout(); groupBoxaccount.SuspendLayout(); @@ -201,7 +203,7 @@ namespace FireWallet // toolStripDropDownButtonHelp // toolStripDropDownButtonHelp.DisplayStyle = ToolStripItemDisplayStyle.Text; - toolStripDropDownButtonHelp.DropDownItems.AddRange(new ToolStripItem[] { githubToolStripMenuItem, websiteToolStripMenuItem, supportDiscordServerToolStripMenuItem }); + toolStripDropDownButtonHelp.DropDownItems.AddRange(new ToolStripItem[] { githubToolStripMenuItem, websiteToolStripMenuItem, supportDiscordServerToolStripMenuItem, toolStripSeparator1, otherProjectsToolStripMenuItem }); toolStripDropDownButtonHelp.Image = (Image)resources.GetObject("toolStripDropDownButtonHelp.Image"); toolStripDropDownButtonHelp.ImageTransparentColor = Color.Magenta; toolStripDropDownButtonHelp.Margin = new Padding(20, 2, 0, 0); @@ -798,6 +800,16 @@ namespace FireWallet panelDomains.TabIndex = 18; panelDomains.Visible = false; // + // labelDomainSort + // + labelDomainSort.AutoSize = true; + labelDomainSort.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); + labelDomainSort.Location = new Point(638, 15); + labelDomainSort.Name = "labelDomainSort"; + labelDomainSort.Size = new Size(42, 21); + labelDomainSort.TabIndex = 12; + labelDomainSort.Text = "Sort:"; + // // comboBoxDomainSort // comboBoxDomainSort.DropDownStyle = ComboBoxStyle.DropDownList; @@ -1081,15 +1093,17 @@ namespace FireWallet textBoxExTX.Size = new Size(307, 29); textBoxExTX.TabIndex = 1; // - // labelDomainSort + // toolStripSeparator1 // - labelDomainSort.AutoSize = true; - labelDomainSort.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); - labelDomainSort.Location = new Point(638, 15); - labelDomainSort.Name = "labelDomainSort"; - labelDomainSort.Size = new Size(42, 21); - labelDomainSort.TabIndex = 12; - labelDomainSort.Text = "Sort:"; + toolStripSeparator1.Name = "toolStripSeparator1"; + toolStripSeparator1.Size = new Size(191, 6); + // + // otherProjectsToolStripMenuItem + // + otherProjectsToolStripMenuItem.Name = "otherProjectsToolStripMenuItem"; + otherProjectsToolStripMenuItem.Size = new Size(194, 22); + otherProjectsToolStripMenuItem.Text = "Other Projects"; + otherProjectsToolStripMenuItem.Click += otherProjectsToolStripMenuItem_Click; // // MainForm // @@ -1234,5 +1248,7 @@ namespace FireWallet private Label labelSendingHIPAddress; private ComboBox comboBoxDomainSort; private Label labelDomainSort; + private ToolStripSeparator toolStripSeparator1; + private ToolStripMenuItem otherProjectsToolStripMenuItem; } } \ No newline at end of file diff --git a/FireWallet/MainForm.cs b/FireWallet/MainForm.cs index 9b5e83c..a8fab45 100644 --- a/FireWallet/MainForm.cs +++ b/FireWallet/MainForm.cs @@ -53,10 +53,13 @@ namespace FireWallet LoadSettings(); UpdateTheme(); // Theme drop down - foreach (ToolStripMenuItem c in toolStripDropDownButtonHelp.DropDownItems) + foreach (ToolStripItem item in toolStripDropDownButtonHelp.DropDownItems) { - c.ForeColor = ColorTranslator.FromHtml(theme["foreground"]); - c.BackColor = ColorTranslator.FromHtml(theme["background"]); + if (item is ToolStripDropDownItem dropDownItem) + { + dropDownItem.ForeColor = ColorTranslator.FromHtml(theme["foreground"]); + dropDownItem.BackColor = ColorTranslator.FromHtml(theme["background"]); + } } toolStripDropDownButtonHelp.DropDown.BackColor = ColorTranslator.FromHtml(theme["background"]); @@ -221,28 +224,29 @@ namespace FireWallet return false; } } - } else + } + else { if (!Directory.Exists(dir + "hsd")) - { - NotifyForm Notifyinstall = new NotifyForm("Installing hsd\nThis may take a few minutes\nDo not close FireWallet", false); - Notifyinstall.Show(); - // Wait for the notification to show - await Task.Delay(1000); + { + NotifyForm Notifyinstall = new NotifyForm("Installing hsd\nThis may take a few minutes\nDo not close FireWallet", false); + Notifyinstall.Show(); + // Wait for the notification to show + await Task.Delay(1000); - string repositoryUrl = "https://github.com/handshake-org/hsd.git"; - string destinationPath = dir + "hsd"; - CloneRepository(repositoryUrl, destinationPath); + string repositoryUrl = "https://github.com/handshake-org/hsd.git"; + string destinationPath = dir + "hsd"; + CloneRepository(repositoryUrl, destinationPath); - Notifyinstall.CloseNotification(); - Notifyinstall.Dispose(); - } - if (!Directory.Exists(dir + "hsd\\node_modules")) - { - AddLog("HSD install failed"); - this.Close(); - return false; - } + Notifyinstall.CloseNotification(); + Notifyinstall.Dispose(); + } + if (!Directory.Exists(dir + "hsd\\node_modules")) + { + AddLog("HSD install failed"); + this.Close(); + return false; + } } @@ -1650,7 +1654,7 @@ namespace FireWallet if (!outputInstalled.Contains("git version")) { AddLog("Git is not installed"); - NotifyForm notifyForm = new NotifyForm("Git is not installed\nPlease install it to install HSD dependencies","Install", "https://git-scm.com/download/win"); + NotifyForm notifyForm = new NotifyForm("Git is not installed\nPlease install it to install HSD dependencies", "Install", "https://git-scm.com/download/win"); notifyForm.ShowDialog(); notifyForm.Dispose(); this.Close(); @@ -1672,7 +1676,7 @@ namespace FireWallet if (!outputInstalled.Contains("v")) { AddLog("Node is not installed"); - NotifyForm notifyForm = new NotifyForm("Node is not installed\nPlease install it to install HSD dependencies","Install", "https://nodejs.org/en/download"); + NotifyForm notifyForm = new NotifyForm("Node is not installed\nPlease install it to install HSD dependencies", "Install", "https://nodejs.org/en/download"); notifyForm.ShowDialog(); notifyForm.Dispose(); this.Close(); @@ -1698,7 +1702,7 @@ namespace FireWallet { AddLog("NPM is not installed"); AddLog(outputInstalled); - NotifyForm notifyForm = new NotifyForm("NPM is not installed\nPlease install it to install HSD dependencies","Install", "https://docs.npmjs.com/downloading-and-installing-node-js-and-npm"); + NotifyForm notifyForm = new NotifyForm("NPM is not installed\nPlease install it to install HSD dependencies", "Install", "https://docs.npmjs.com/downloading-and-installing-node-js-and-npm"); notifyForm.ShowDialog(); notifyForm.Dispose(); this.Close(); @@ -2247,6 +2251,15 @@ namespace FireWallet }; Process.Start(psi); } + private void otherProjectsToolStripMenuItem_Click(object sender, EventArgs e) + { + ProcessStartInfo psi = new ProcessStartInfo + { + FileName = "https://nathan.woodburn.au/projects", + UseShellExecute = true + }; + Process.Start(psi); + } #endregion } } \ No newline at end of file