1
0
mirror of https://github.com/Ylianst/MeshCentralRouter synced 2025-12-06 00:13:33 +00:00

UI improvements

This commit is contained in:
Ylian Saint-Hilaire
2020-11-10 01:06:48 -08:00
parent 9958278fe6
commit 2b6bfdae4c
5 changed files with 1330 additions and 503 deletions

View File

@@ -34,6 +34,7 @@
this.label1 = new System.Windows.Forms.Label();
this.okButton = new System.Windows.Forms.Button();
this.cancelButton = new System.Windows.Forms.Button();
this.systemTrayCheckBox = new System.Windows.Forms.CheckBox();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
@@ -42,11 +43,12 @@
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox1.Controls.Add(this.systemTrayCheckBox);
this.groupBox1.Controls.Add(this.doubleClickComboBox);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Location = new System.Drawing.Point(12, 12);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(294, 81);
this.groupBox1.Size = new System.Drawing.Size(294, 99);
this.groupBox1.TabIndex = 5;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Settings";
@@ -82,7 +84,7 @@
//
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.okButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.okButton.Location = new System.Drawing.Point(150, 99);
this.okButton.Location = new System.Drawing.Point(150, 117);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(75, 23);
this.okButton.TabIndex = 4;
@@ -95,20 +97,31 @@
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.cancelButton.Location = new System.Drawing.Point(231, 99);
this.cancelButton.Location = new System.Drawing.Point(231, 117);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 23);
this.cancelButton.TabIndex = 3;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
//
// systemTrayCheckBox
//
this.systemTrayCheckBox.AutoSize = true;
this.systemTrayCheckBox.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.systemTrayCheckBox.Location = new System.Drawing.Point(14, 70);
this.systemTrayCheckBox.Name = "systemTrayCheckBox";
this.systemTrayCheckBox.Size = new System.Drawing.Size(123, 17);
this.systemTrayCheckBox.TabIndex = 2;
this.systemTrayCheckBox.Text = "Show on system tray";
this.systemTrayCheckBox.UseVisualStyleBackColor = true;
//
// DeviceSettingsForm
//
this.AcceptButton = this.okButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(318, 134);
this.ClientSize = new System.Drawing.Size(318, 152);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.okButton);
this.Controls.Add(this.cancelButton);
@@ -131,5 +144,6 @@
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.ComboBox doubleClickComboBox;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.CheckBox systemTrayCheckBox;
}
}

View File

@@ -24,6 +24,12 @@ namespace MeshCentralRouter
set { doubleClickComboBox.SelectedIndex = value; }
}
public bool ShowSystemTray
{
get { return systemTrayCheckBox.Checked; }
set { systemTrayCheckBox.Checked = value; }
}
private void okButton_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.OK;

46
MainForm.Designer.cs generated
View File

@@ -109,7 +109,6 @@
this.cancelAutoCloseButton2 = new System.Windows.Forms.Button();
this.mapPanel = new System.Windows.Forms.Panel();
this.noMapLabel = new System.Windows.Forms.Label();
this.settingsPictureBox = new System.Windows.Forms.PictureBox();
this.helpPictureBox = new System.Windows.Forms.PictureBox();
this.addButton = new System.Windows.Forms.Button();
this.addRelayButton = new System.Windows.Forms.Button();
@@ -131,6 +130,9 @@
this.saveMappingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.openMapFileDialog = new System.Windows.Forms.OpenFileDialog();
this.saveMapFileDialog = new System.Windows.Forms.SaveFileDialog();
this.toolStripMenuItem5 = new System.Windows.Forms.ToolStripSeparator();
this.settingsToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.settingsPictureBox = new System.Windows.Forms.PictureBox();
this.panel5.SuspendLayout();
this.mainPanel.SuspendLayout();
this.mainTabControl.SuspendLayout();
@@ -154,12 +156,12 @@
this.devicesContextMenuStrip.SuspendLayout();
this.portMapTabPage.SuspendLayout();
this.mapPanel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.settingsPictureBox)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.helpPictureBox)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox7)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.trayIconContextMenuStrip.SuspendLayout();
this.mappingsContextMenuStrip.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.settingsPictureBox)).BeginInit();
this.SuspendLayout();
//
// panel5
@@ -618,6 +620,7 @@
this.devicesListView.Sorting = System.Windows.Forms.SortOrder.Ascending;
this.devicesListView.UseCompatibleStateImageBehavior = false;
this.devicesListView.View = System.Windows.Forms.View.Details;
this.devicesListView.Click += new System.EventHandler(this.devicesListView_Click);
this.devicesListView.DoubleClick += new System.EventHandler(this.devicesListView_DoubleClick);
this.devicesListView.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.MainForm_KeyPress);
//
@@ -771,15 +774,6 @@
resources.ApplyResources(this.noMapLabel, "noMapLabel");
this.noMapLabel.Name = "noMapLabel";
//
// settingsPictureBox
//
resources.ApplyResources(this.settingsPictureBox, "settingsPictureBox");
this.settingsPictureBox.Cursor = System.Windows.Forms.Cursors.Hand;
this.settingsPictureBox.Image = global::MeshCentralRouter.Properties.Resources.Gear20;
this.settingsPictureBox.Name = "settingsPictureBox";
this.settingsPictureBox.TabStop = false;
this.settingsPictureBox.Click += new System.EventHandler(this.settingsPictureBox_Click);
//
// helpPictureBox
//
resources.ApplyResources(this.helpPictureBox, "helpPictureBox");
@@ -893,7 +887,9 @@
//
this.mappingsContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.openMappingsToolStripMenuItem,
this.saveMappingsToolStripMenuItem});
this.saveMappingsToolStripMenuItem,
this.toolStripMenuItem5,
this.settingsToolStripMenuItem1});
this.mappingsContextMenuStrip.Name = "mappingsContextMenuStrip";
resources.ApplyResources(this.mappingsContextMenuStrip, "mappingsContextMenuStrip");
//
@@ -919,6 +915,26 @@
this.saveMapFileDialog.DefaultExt = "mcrouter";
resources.ApplyResources(this.saveMapFileDialog, "saveMapFileDialog");
//
// toolStripMenuItem5
//
this.toolStripMenuItem5.Name = "toolStripMenuItem5";
resources.ApplyResources(this.toolStripMenuItem5, "toolStripMenuItem5");
//
// settingsToolStripMenuItem1
//
this.settingsToolStripMenuItem1.Name = "settingsToolStripMenuItem1";
resources.ApplyResources(this.settingsToolStripMenuItem1, "settingsToolStripMenuItem1");
this.settingsToolStripMenuItem1.Click += new System.EventHandler(this.settingsPictureBox_Click);
//
// settingsPictureBox
//
resources.ApplyResources(this.settingsPictureBox, "settingsPictureBox");
this.settingsPictureBox.Cursor = System.Windows.Forms.Cursors.Hand;
this.settingsPictureBox.Image = global::MeshCentralRouter.Properties.Resources.Gear20;
this.settingsPictureBox.Name = "settingsPictureBox";
this.settingsPictureBox.TabStop = false;
this.settingsPictureBox.Click += new System.EventHandler(this.settingsPictureBox_Click);
//
// MainForm
//
resources.ApplyResources(this, "$this");
@@ -958,12 +974,12 @@
this.devicesContextMenuStrip.ResumeLayout(false);
this.portMapTabPage.ResumeLayout(false);
this.mapPanel.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.settingsPictureBox)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.helpPictureBox)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox7)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.trayIconContextMenuStrip.ResumeLayout(false);
this.mappingsContextMenuStrip.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.settingsPictureBox)).EndInit();
this.ResumeLayout(false);
}
@@ -1024,7 +1040,6 @@
private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
private System.Windows.Forms.PictureBox settingsPictureBox;
private System.Windows.Forms.TabControl devicesTabControl;
private System.Windows.Forms.TabPage devicesTabPage;
private System.Windows.Forms.TabPage portMapTabPage;
@@ -1070,6 +1085,9 @@
private System.Windows.Forms.Button cancelAutoCloseButton2;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem4;
private System.Windows.Forms.ToolStripMenuItem settingsToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem5;
private System.Windows.Forms.ToolStripMenuItem settingsToolStripMenuItem1;
private System.Windows.Forms.PictureBox settingsPictureBox;
}
}

View File

@@ -384,6 +384,7 @@ namespace MeshCentralRouter
private void backButton5_Click(object sender, EventArgs e)
{
cancelAutoClose();
meshcentral.disconnect();
}
@@ -415,7 +416,7 @@ namespace MeshCentralRouter
meshcentral.onLoginTokenChanged += Meshcentral_onLoginTokenChanged;
meshcentral.onClipboardData += Meshcentral_onClipboardData;
meshcentral.onTwoFactorCookie += Meshcentral_onTwoFactorCookie;
meshcentral.onToolUpdate += Meshcentral_onToolUpdate;
//meshcentral.onToolUpdate += Meshcentral_onToolUpdate;
if (lastBadConnectCert != null)
{
meshcentral.okCertHash = lastBadConnectCert.GetCertHashString();
@@ -983,6 +984,7 @@ namespace MeshCentralRouter
private void addButton_Click(object sender, EventArgs e)
{
cancelAutoClose();
AddPortMapForm form = new AddPortMapForm(meshcentral);
if (sender == null)
@@ -1131,8 +1133,16 @@ namespace MeshCentralRouter
X509Certificate2UI.DisplayCertificate(lastBadConnectCert);
}
private void cancelAutoClose()
{
autoExitProc = null;
cancelAutoCloseButton1.Visible = false;
cancelAutoCloseButton2.Visible = false;
}
private void addRelayMapButton_Click(object sender, EventArgs e)
{
cancelAutoClose();
AddRelayMapForm form = new AddRelayMapForm(meshcentral);
if (sender == null)
@@ -1171,11 +1181,13 @@ namespace MeshCentralRouter
private void helpPictureBox_Click(object sender, EventArgs e)
{
cancelAutoClose();
new MappingHelpForm().ShowDialog(this);
}
private void openWebSiteButton_Click(object sender, EventArgs e)
{
cancelAutoClose();
if (meshcentral.loginCookie != null) {
Uri serverurl = null;
if (authLoginUrl != null) {
@@ -1212,6 +1224,7 @@ namespace MeshCentralRouter
private void settingsPictureBox_Click(object sender, EventArgs e)
{
cancelAutoClose();
SettingsForm f = new SettingsForm();
f.BindAllInterfaces = inaddrany;
f.ShowSystemTray = (notifyIcon.Visible == true);
@@ -1267,6 +1280,7 @@ namespace MeshCentralRouter
private void devicesTabControl_SelectedIndexChanged(object sender, EventArgs e)
{
cancelAutoClose();
searchTextBox.Visible = (devicesTabControl.SelectedIndex == 0);
if (devicesTabControl.SelectedIndex == 0) {
menuLabel.ContextMenuStrip = mainContextMenuStrip;
@@ -1277,6 +1291,7 @@ namespace MeshCentralRouter
private void searchTextBox_KeyPress(object sender, KeyPressEventArgs e)
{
cancelAutoClose();
if (e.KeyChar == 27) { searchTextBox.Text = ""; e.Handled = true; }
}
@@ -1349,6 +1364,7 @@ namespace MeshCentralRouter
private void menuLabel_Click(object sender, EventArgs e)
{
cancelAutoClose();
if (devicesTabControl.SelectedIndex == 0)
{
mainContextMenuStrip.Show(menuLabel, menuLabel.PointToClient(Cursor.Position));
@@ -1518,6 +1534,7 @@ namespace MeshCentralRouter
private void mapPanel_DragEnter(object sender, DragEventArgs e)
{
cancelAutoClose();
if (e.Data.GetDataPresent(DataFormats.FileDrop) == false) return;
string[] s = (string[])e.Data.GetData(DataFormats.FileDrop, false);
if ((s.Length != 1) || (s[0].ToLower().EndsWith(".mcrouter") == false)) return;
@@ -1526,6 +1543,7 @@ namespace MeshCentralRouter
private void mapPanel_DragDrop(object sender, DragEventArgs e)
{
cancelAutoClose();
if (e.Data.GetDataPresent(DataFormats.FileDrop) == false) return;
string[] s = (string[])e.Data.GetData(DataFormats.FileDrop, false);
if ((s.Length != 1) || (s[0].ToLower().EndsWith(".mcrouter") == false)) return;
@@ -1622,6 +1640,7 @@ namespace MeshCentralRouter
private void devicesListView_DoubleClick(object sender, EventArgs e)
{
cancelAutoClose();
if (devicesListView.SelectedItems.Count != 1) { return; }
ListViewItem selecteditem = devicesListView.SelectedItems[0];
NodeClass node = (NodeClass)selecteditem.Tag;
@@ -1674,9 +1693,7 @@ namespace MeshCentralRouter
private void cancelAutoCloseButton_Click(object sender, EventArgs e)
{
autoExitProc = null;
cancelAutoCloseButton1.Visible = false;
cancelAutoCloseButton2.Visible = false;
cancelAutoClose();
}
public delegate void SetAutoCloseHandler();
@@ -1691,16 +1708,30 @@ namespace MeshCentralRouter
{
DeviceSettingsForm f = new DeviceSettingsForm();
f.deviceDoubleClickAction = deviceDoubleClickAction;
f.ShowSystemTray = (notifyIcon.Visible == true);
if (f.ShowDialog(this) == DialogResult.OK)
{
deviceDoubleClickAction = f.deviceDoubleClickAction;
setRegValue("DevDoubleClickClickAction", deviceDoubleClickAction.ToString());
setDoubleClickDeviceAction();
if (f.ShowSystemTray)
{
notifyIcon.Visible = true;
this.ShowInTaskbar = false;
this.MinimizeBox = false;
}
else
{
notifyIcon.Visible = false;
this.ShowInTaskbar = true;
this.MinimizeBox = true;
}
}
}
private void MainForm_KeyPress(object sender, KeyPressEventArgs e)
{
cancelAutoClose();
if ((currentPanel == 4) && (devicesTabControl.SelectedIndex == 0))
{
if (e.KeyChar == 27)
@@ -1722,6 +1753,11 @@ namespace MeshCentralRouter
}
}
private void devicesListView_Click(object sender, EventArgs e)
{
cancelAutoClose();
}
/*
private delegate void displayMessageHandler(string msg, int buttons, string extra, int progress);
private void displayMessage(string msg, int buttons = 0, string extra = "", int progress = 0)

File diff suppressed because it is too large Load Diff