From 8d75f308fc022887cd64c6bb70fbeb9fd287f519 Mon Sep 17 00:00:00 2001 From: Nathan Woodburn Date: Wed, 7 Jun 2023 13:00:08 +1000 Subject: [PATCH] notify: Added optional link button --- FireWallet/NotifyForm.Designer.cs | 39 +++++++++++++++++++++---------- FireWallet/NotifyForm.cs | 26 ++++++++++++++++++++- 2 files changed, 52 insertions(+), 13 deletions(-) diff --git a/FireWallet/NotifyForm.Designer.cs b/FireWallet/NotifyForm.Designer.cs index 8920040..fa9e772 100644 --- a/FireWallet/NotifyForm.Designer.cs +++ b/FireWallet/NotifyForm.Designer.cs @@ -29,7 +29,8 @@ private void InitializeComponent() { labelmessage = new Label(); - button1 = new Button(); + buttonOK = new Button(); + buttonALT = new Button(); SuspendLayout(); // // labelmessage @@ -43,23 +44,36 @@ labelmessage.Text = "Message"; labelmessage.TextAlign = ContentAlignment.TopCenter; // - // button1 + // buttonOK // - button1.Font = new Font("Segoe UI", 15F, FontStyle.Regular, GraphicsUnit.Point); - button1.Location = new Point(271, 120); - button1.Name = "button1"; - button1.Size = new Size(99, 38); - button1.TabIndex = 1; - button1.Text = "Ok"; - button1.UseVisualStyleBackColor = true; - button1.Click += button1_Click; + buttonOK.Font = new Font("Segoe UI", 15F, FontStyle.Regular, GraphicsUnit.Point); + buttonOK.Location = new Point(271, 120); + buttonOK.Name = "buttonOK"; + buttonOK.Size = new Size(99, 38); + buttonOK.TabIndex = 1; + buttonOK.Text = "Ok"; + buttonOK.UseVisualStyleBackColor = true; + buttonOK.Click += OK_Click; + // + // buttonALT + // + buttonALT.Font = new Font("Segoe UI", 15F, FontStyle.Regular, GraphicsUnit.Point); + buttonALT.Location = new Point(12, 120); + buttonALT.Name = "buttonALT"; + buttonALT.Size = new Size(99, 38); + buttonALT.TabIndex = 2; + buttonALT.Text = "ALT"; + buttonALT.UseVisualStyleBackColor = true; + buttonALT.Visible = false; + buttonALT.Click += buttonALT_Click; // // NotifyForm // AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; ClientSize = new Size(382, 170); - Controls.Add(button1); + Controls.Add(buttonALT); + Controls.Add(buttonOK); Controls.Add(labelmessage); FormBorderStyle = FormBorderStyle.FixedDialog; Name = "NotifyForm"; @@ -71,6 +85,7 @@ #endregion private Label labelmessage; - private Button button1; + private Button buttonOK; + private Button buttonALT; } } \ No newline at end of file diff --git a/FireWallet/NotifyForm.cs b/FireWallet/NotifyForm.cs index bafc11f..b7443da 100644 --- a/FireWallet/NotifyForm.cs +++ b/FireWallet/NotifyForm.cs @@ -2,9 +2,11 @@ using System.Collections.Generic; using System.ComponentModel; using System.Data; +using System.Diagnostics; using System.Drawing; using System.Linq; using System.Runtime.InteropServices; +using System.Security.Policy; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; @@ -15,10 +17,21 @@ namespace FireWallet { string dir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\FireWallet\\"; Dictionary theme; + string altLink; public NotifyForm(string Message) { InitializeComponent(); labelmessage.Text = Message; + altLink = ""; + } + + public NotifyForm(string Message, string altText, string altLink) + { + InitializeComponent(); + labelmessage.Text = Message; + buttonALT.Text = altText; + buttonALT.Visible = true; + this.altLink = altLink; } #region Theming @@ -199,9 +212,20 @@ namespace FireWallet UpdateTheme(); } - private void button1_Click(object sender, EventArgs e) + private void OK_Click(object sender, EventArgs e) { this.Close(); } + + private void buttonALT_Click(object sender, EventArgs e) + { + // Open link + ProcessStartInfo psi = new ProcessStartInfo + { + FileName = altLink, + UseShellExecute = true + }; + Process.Start(psi); + } } }