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()
{
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;
}
}

View File

@ -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<string, string> 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);
}
}
}