notify: Added optional link button

This commit is contained in:
Nathan Woodburn 2023-06-07 13:00:08 +10:00
parent 2da17c2d7d
commit 8d75f308fc
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1
2 changed files with 52 additions and 13 deletions

View File

@ -29,7 +29,8 @@
private void InitializeComponent() private void InitializeComponent()
{ {
labelmessage = new Label(); labelmessage = new Label();
button1 = new Button(); buttonOK = new Button();
buttonALT = new Button();
SuspendLayout(); SuspendLayout();
// //
// labelmessage // labelmessage
@ -43,23 +44,36 @@
labelmessage.Text = "Message"; labelmessage.Text = "Message";
labelmessage.TextAlign = ContentAlignment.TopCenter; labelmessage.TextAlign = ContentAlignment.TopCenter;
// //
// button1 // buttonOK
// //
button1.Font = new Font("Segoe UI", 15F, FontStyle.Regular, GraphicsUnit.Point); buttonOK.Font = new Font("Segoe UI", 15F, FontStyle.Regular, GraphicsUnit.Point);
button1.Location = new Point(271, 120); buttonOK.Location = new Point(271, 120);
button1.Name = "button1"; buttonOK.Name = "buttonOK";
button1.Size = new Size(99, 38); buttonOK.Size = new Size(99, 38);
button1.TabIndex = 1; buttonOK.TabIndex = 1;
button1.Text = "Ok"; buttonOK.Text = "Ok";
button1.UseVisualStyleBackColor = true; buttonOK.UseVisualStyleBackColor = true;
button1.Click += button1_Click; 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 // NotifyForm
// //
AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(382, 170); ClientSize = new Size(382, 170);
Controls.Add(button1); Controls.Add(buttonALT);
Controls.Add(buttonOK);
Controls.Add(labelmessage); Controls.Add(labelmessage);
FormBorderStyle = FormBorderStyle.FixedDialog; FormBorderStyle = FormBorderStyle.FixedDialog;
Name = "NotifyForm"; Name = "NotifyForm";
@ -71,6 +85,7 @@
#endregion #endregion
private Label labelmessage; private Label labelmessage;
private Button button1; private Button buttonOK;
private Button buttonALT;
} }
} }

View File

@ -2,9 +2,11 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Data; using System.Data;
using System.Diagnostics;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Security.Policy;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
@ -15,10 +17,21 @@ namespace FireWallet
{ {
string dir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\FireWallet\\"; string dir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\FireWallet\\";
Dictionary<string, string> theme; Dictionary<string, string> theme;
string altLink;
public NotifyForm(string Message) public NotifyForm(string Message)
{ {
InitializeComponent(); InitializeComponent();
labelmessage.Text = Message; 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 #region Theming
@ -199,9 +212,20 @@ namespace FireWallet
UpdateTheme(); UpdateTheme();
} }
private void button1_Click(object sender, EventArgs e) private void OK_Click(object sender, EventArgs e)
{ {
this.Close(); this.Close();
} }
private void buttonALT_Click(object sender, EventArgs e)
{
// Open link
ProcessStartInfo psi = new ProcessStartInfo
{
FileName = altLink,
UseShellExecute = true
};
Process.Start(psi);
}
} }
} }