Redesign

alphons <alphons@heijden.com> 29 Aug 2025, 20:31
2c2f70e3dc34cdb24ee7f658c2b3dacab308c976
6 files changed
  • WireGuardConfigGenerator/Form1.Designer.cs
  • WireGuardConfigGenerator/FormPassword.Designer.cs
  • WireGuardConfigGenerator/FormPassword.cs
  • WireGuardConfigGenerator/FormPassword.resx
  • WireGuardConfigGenerator/UserControlPeer.Designer.cs
  • WireGuardConfigGenerator/UserControlPeer.cs
diff --git a/WireGuardConfigGenerator/Form1.Designer.cs b/WireGuardConfigGenerator/Form1.Designer.cs
index 1d064bf..ff07756 100644
--- a/WireGuardConfigGenerator/Form1.Designer.cs
+++ b/WireGuardConfigGenerator/Form1.Designer.cs
@@ -61,19 +61,19 @@
// toolStripMenuItem1
//
toolStripMenuItem1.Name = "toolStripMenuItem1";
- toolStripMenuItem1.Size = new Size(180, 22);
+ toolStripMenuItem1.Size = new Size(115, 22);
toolStripMenuItem1.Text = "Open ...";
toolStripMenuItem1.Click += OpenFile_Click;
//
// toolStripSeparator1
//
toolStripSeparator1.Name = "toolStripSeparator1";
- toolStripSeparator1.Size = new Size(177, 6);
+ toolStripSeparator1.Size = new Size(112, 6);
//
// exitToolStripMenuItem
//
exitToolStripMenuItem.Name = "exitToolStripMenuItem";
- exitToolStripMenuItem.Size = new Size(180, 22);
+ exitToolStripMenuItem.Size = new Size(115, 22);
exitToolStripMenuItem.Text = "Exit";
exitToolStripMenuItem.Click += Exit_Click;
//
@@ -96,6 +96,7 @@
splitContainer1.Panel1.Controls.Add(userControlTree1);
splitContainer1.Size = new Size(1022, 515);
splitContainer1.SplitterDistance = 339;
+ splitContainer1.SplitterWidth = 8;
splitContainer1.TabIndex = 2;
//
// userControlTree1
diff --git a/WireGuardConfigGenerator/FormPassword.Designer.cs b/WireGuardConfigGenerator/FormPassword.Designer.cs
index 58b2c46..ef4ef6a 100644
--- a/WireGuardConfigGenerator/FormPassword.Designer.cs
+++ b/WireGuardConfigGenerator/FormPassword.Designer.cs
@@ -31,75 +31,79 @@
label1 = new Label();
txtPassword = new TextBox();
btnOk = new Button();
- btnCancel = new Button();
txtPath = new TextBox();
label2 = new Label();
+ button1 = new Button();
+ openFileDialog1 = new OpenFileDialog();
SuspendLayout();
//
// label1
//
label1.AutoSize = true;
- label1.Location = new Point(16, 47);
+ label1.Location = new Point(12, 57);
label1.Name = "label1";
label1.Size = new Size(57, 15);
label1.TabIndex = 0;
- label1.Text = "password";
+ label1.Text = "Password";
//
// txtPassword
//
- txtPassword.Location = new Point(16, 65);
+ txtPassword.Location = new Point(12, 75);
txtPassword.Name = "txtPassword";
txtPassword.PasswordChar = '*';
- txtPassword.Size = new Size(167, 23);
+ txtPassword.Size = new Size(142, 23);
txtPassword.TabIndex = 1;
//
// btnOk
//
- btnOk.Location = new Point(135, 94);
+ btnOk.Location = new Point(160, 74);
btnOk.Name = "btnOk";
- btnOk.Size = new Size(48, 23);
+ btnOk.Size = new Size(75, 23);
btnOk.TabIndex = 2;
btnOk.Text = "Ok";
btnOk.UseVisualStyleBackColor = true;
btnOk.Click += Ok_Click;
//
- // btnCancel
- //
- btnCancel.Location = new Point(54, 94);
- btnCancel.Name = "btnCancel";
- btnCancel.Size = new Size(75, 23);
- btnCancel.TabIndex = 3;
- btnCancel.Text = "Cancel";
- btnCancel.UseVisualStyleBackColor = true;
- btnCancel.Click += Cancel_Click;
- //
// txtPath
//
- txtPath.Location = new Point(16, 21);
+ txtPath.Location = new Point(12, 27);
txtPath.Name = "txtPath";
- txtPath.Size = new Size(167, 23);
+ txtPath.Size = new Size(464, 23);
txtPath.TabIndex = 5;
txtPath.Text = "wireguard.db";
//
// label2
//
label2.AutoSize = true;
- label2.Location = new Point(16, 3);
+ label2.Location = new Point(12, 9);
label2.Name = "label2";
- label2.Size = new Size(23, 15);
+ label2.Size = new Size(22, 15);
label2.TabIndex = 4;
- label2.Text = "file";
+ label2.Text = "Db";
+ //
+ // button1
+ //
+ button1.Location = new Point(401, 56);
+ button1.Name = "button1";
+ button1.Size = new Size(75, 23);
+ button1.TabIndex = 6;
+ button1.Text = "File...";
+ button1.UseVisualStyleBackColor = true;
+ button1.Click += SelectFile_Click;
+ //
+ // openFileDialog1
+ //
+ openFileDialog1.FileName = "openFileDialog1";
//
// FormPassword
//
AcceptButton = btnOk;
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
- CancelButton = btnCancel;
- ClientSize = new Size(193, 126);
+ ClientSize = new Size(488, 106);
+ Controls.Add(button1);
Controls.Add(txtPath);
Controls.Add(label2);
- Controls.Add(btnCancel);
Controls.Add(btnOk);
Controls.Add(txtPassword);
Controls.Add(label1);
@@ -119,8 +123,9 @@
private Label label1;
private TextBox txtPassword;
private Button btnOk;
- private Button btnCancel;
private TextBox txtPath;
private Label label2;
+ private Button button1;
+ private OpenFileDialog openFileDialog1;
}
}
\ No newline at end of file
diff --git a/WireGuardConfigGenerator/FormPassword.cs b/WireGuardConfigGenerator/FormPassword.cs
index 9b31927..1c92a74 100644
--- a/WireGuardConfigGenerator/FormPassword.cs
+++ b/WireGuardConfigGenerator/FormPassword.cs
@@ -21,4 +21,18 @@ public partial class FormPassword : Form
{
this.Close();
}
+
+ private void SelectFile_Click(object sender, EventArgs e)
+ {
+ this.openFileDialog1.CheckPathExists = true;
+ this.openFileDialog1.InitialDirectory = AppContext.BaseDirectory;
+ this.openFileDialog1.Filter = "Wireguard db files|*.db|All Files|*.*";
+ this.openFileDialog1.FileName = this.txtPath.Text;
+ this.openFileDialog1.RestoreDirectory = true;
+
+ if (this.openFileDialog1.ShowDialog(this) == DialogResult.OK)
+ {
+ this.txtPath.Text = this.openFileDialog1.FileName.Replace(AppContext.BaseDirectory, string.Empty);
+ }
+ }
}
diff --git a/WireGuardConfigGenerator/FormPassword.resx b/WireGuardConfigGenerator/FormPassword.resx
index 8b2ff64..5989857 100644
--- a/WireGuardConfigGenerator/FormPassword.resx
+++ b/WireGuardConfigGenerator/FormPassword.resx
@@ -117,4 +117,7 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
+ <metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>17, 17</value>
+ </metadata>
</root>
\ No newline at end of file
diff --git a/WireGuardConfigGenerator/UserControlPeer.Designer.cs b/WireGuardConfigGenerator/UserControlPeer.Designer.cs
index 9ad2cd1..2d52a22 100644
--- a/WireGuardConfigGenerator/UserControlPeer.Designer.cs
+++ b/WireGuardConfigGenerator/UserControlPeer.Designer.cs
@@ -54,6 +54,8 @@
buttonEdit = new Button();
lblName = new Label();
label4 = new Label();
+ label7 = new Label();
+ txtDnsServers = new TextBox();
tabControl1.SuspendLayout();
tabPage0.SuspendLayout();
tabPage1.SuspendLayout();
@@ -128,6 +130,8 @@
// groupBox1
//
groupBox1.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
+ groupBox1.Controls.Add(txtDnsServers);
+ groupBox1.Controls.Add(label7);
groupBox1.Controls.Add(button3);
groupBox1.Controls.Add(button1);
groupBox1.Controls.Add(comboBox1);
@@ -337,6 +341,23 @@
label4.TabIndex = 12;
label4.Text = "Name:";
//
+ // label7
+ //
+ label7.AutoSize = true;
+ label7.Location = new Point(145, 191);
+ label7.Name = "label7";
+ label7.Size = new Size(69, 15);
+ label7.TabIndex = 22;
+ label7.Text = "DNS servers";
+ //
+ // txtDnsServers
+ //
+ txtDnsServers.Font = new Font("Consolas", 8.25F);
+ txtDnsServers.Location = new Point(240, 189);
+ txtDnsServers.Name = "txtDnsServers";
+ txtDnsServers.Size = new Size(159, 20);
+ txtDnsServers.TabIndex = 23;
+ //
// UserControlPeer
//
AutoScaleDimensions = new SizeF(7F, 15F);
@@ -381,5 +402,7 @@
private ComboBox comboBox1;
private Button button1;
private Button button3;
+ private TextBox txtDnsServers;
+ private Label label7;
}
}
diff --git a/WireGuardConfigGenerator/UserControlPeer.cs b/WireGuardConfigGenerator/UserControlPeer.cs
index b2a6b3f..3e2c7a1 100644
--- a/WireGuardConfigGenerator/UserControlPeer.cs
+++ b/WireGuardConfigGenerator/UserControlPeer.cs
@@ -33,6 +33,7 @@ public partial class UserControlPeer : UserControl
PrivateKey = {this.peer.PrivateKey}
ListenPort = {this.peer.ListenPort}
Address = {this.peer.Address}
+ DNS = {this.peer.DNS}
""";
@@ -95,6 +96,7 @@ public partial class UserControlPeer : UserControl
this.comboBox1.SelectedItem = peer.Address?.Split('/')[1];
this.txtAllowedIPs.Text = peer.AllowedIPs;
this.txtPersistenKeepAlive.Text = peer.PersistentKeepalive.ToString();
+ this.txtDnsServers.Text = peer.DNS;
}
@@ -109,6 +111,7 @@ public partial class UserControlPeer : UserControl
this.peer.Address = $"{this.txtAddress.Text}/{this.comboBox1.SelectedItem}";
this.peer.AllowedIPs = this.txtAllowedIPs.Text;
this.peer.PersistentKeepalive = int.TryParse(this.txtPersistenKeepAlive.Text, out int pka) ? pka : 0;
+ this.peer.DNS = this.txtDnsServers.Text;
this.buttonEdit.Enabled = true;
this.buttonCancel.Enabled = false;