diff --git a/src/DeviceSettingsForm.Designer.cs b/src/DeviceSettingsForm.Designer.cs
index 385e3cc..b03bbea 100644
--- a/src/DeviceSettingsForm.Designer.cs
+++ b/src/DeviceSettingsForm.Designer.cs
@@ -30,6 +30,7 @@
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DeviceSettingsForm));
this.groupBox1 = new System.Windows.Forms.GroupBox();
+ this.checkForUpdatedCheckBox = new System.Windows.Forms.CheckBox();
this.systemTrayCheckBox = new System.Windows.Forms.CheckBox();
this.doubleClickComboBox = new System.Windows.Forms.ComboBox();
this.label1 = new System.Windows.Forms.Label();
@@ -38,7 +39,7 @@
this.exp_KeyboardHookCheckBox = new System.Windows.Forms.CheckBox();
this.exp_KeyboardHookPriorityCheckBox = new System.Windows.Forms.CheckBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
- this.checkForUpdatedCheckBox = new System.Windows.Forms.CheckBox();
+ this.collapseCheckBox = new System.Windows.Forms.CheckBox();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
@@ -46,6 +47,7 @@
// groupBox1
//
resources.ApplyResources(this.groupBox1, "groupBox1");
+ this.groupBox1.Controls.Add(this.collapseCheckBox);
this.groupBox1.Controls.Add(this.checkForUpdatedCheckBox);
this.groupBox1.Controls.Add(this.systemTrayCheckBox);
this.groupBox1.Controls.Add(this.doubleClickComboBox);
@@ -53,6 +55,12 @@
this.groupBox1.Name = "groupBox1";
this.groupBox1.TabStop = false;
//
+ // checkForUpdatedCheckBox
+ //
+ resources.ApplyResources(this.checkForUpdatedCheckBox, "checkForUpdatedCheckBox");
+ this.checkForUpdatedCheckBox.Name = "checkForUpdatedCheckBox";
+ this.checkForUpdatedCheckBox.UseVisualStyleBackColor = true;
+ //
// systemTrayCheckBox
//
resources.ApplyResources(this.systemTrayCheckBox, "systemTrayCheckBox");
@@ -115,11 +123,11 @@
this.groupBox2.Name = "groupBox2";
this.groupBox2.TabStop = false;
//
- // checkForUpdatedCheckBox
+ // collapseCheckBox
//
- resources.ApplyResources(this.checkForUpdatedCheckBox, "checkForUpdatedCheckBox");
- this.checkForUpdatedCheckBox.Name = "checkForUpdatedCheckBox";
- this.checkForUpdatedCheckBox.UseVisualStyleBackColor = true;
+ resources.ApplyResources(this.collapseCheckBox, "collapseCheckBox");
+ this.collapseCheckBox.Name = "collapseCheckBox";
+ this.collapseCheckBox.UseVisualStyleBackColor = true;
//
// DeviceSettingsForm
//
@@ -155,5 +163,6 @@
private System.Windows.Forms.CheckBox exp_KeyboardHookPriorityCheckBox;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.CheckBox checkForUpdatedCheckBox;
+ private System.Windows.Forms.CheckBox collapseCheckBox;
}
}
\ No newline at end of file
diff --git a/src/DeviceSettingsForm.cs b/src/DeviceSettingsForm.cs
index 5bb67d6..26c8dc5 100644
--- a/src/DeviceSettingsForm.cs
+++ b/src/DeviceSettingsForm.cs
@@ -46,6 +46,12 @@ namespace MeshCentralRouter
set { checkForUpdatedCheckBox.Checked = value; }
}
+ public bool CollapseDeviceGroups
+ {
+ get { return collapseCheckBox.Checked; }
+ set { collapseCheckBox.Checked = value; }
+ }
+
public bool Exp_KeyboardHook
{
get { return exp_KeyboardHookCheckBox.Checked; }
diff --git a/src/DeviceSettingsForm.resx b/src/DeviceSettingsForm.resx
index 79f1449..9ddda4b 100644
--- a/src/DeviceSettingsForm.resx
+++ b/src/DeviceSettingsForm.resx
@@ -122,15 +122,45 @@
Top, Left, Right
+
+ True
+
+
+ NoControl
+
+
+
+ 14, 93
+
+
+ 150, 17
+
+
+ 4
+
+
+ Collapse groups by default
+
+
+ collapseCheckBox
+
+
+ System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ groupBox1
+
+
+ 0
+
True
NoControl
-
- 14, 93
+ 14, 116
113, 17
@@ -151,7 +181,7 @@
groupBox1
- 0
+ 1
True
@@ -181,7 +211,7 @@
groupBox1
- 1
+ 2
Add Map...
@@ -226,7 +256,7 @@
groupBox1
- 2
+ 3
True
@@ -253,13 +283,13 @@
groupBox1
- 3
+ 4
12, 12
- 294, 117
+ 294, 141
5
@@ -286,7 +316,7 @@
NoControl
- 150, 211
+ 150, 240
75, 23
@@ -316,7 +346,7 @@
NoControl
- 231, 211
+ 231, 240
75, 23
@@ -403,10 +433,10 @@
Top, Bottom, Left, Right
- 12, 135
+ 12, 159
- 294, 70
+ 294, 75
6
@@ -433,7 +463,7 @@
6, 13
- 318, 246
+ 318, 275
@@ -2129,6 +2159,9 @@
AADAPwAAwD8AAMA/AADAPwAA
+
+ NoControl
+
CenterParent
diff --git a/src/MainForm.cs b/src/MainForm.cs
index e9bda56..2a97c72 100644
--- a/src/MainForm.cs
+++ b/src/MainForm.cs
@@ -52,6 +52,7 @@ namespace MeshCentralRouter
public bool sendEmailToken = false;
public bool sendSMSToken = false;
public bool allowUpdates = Settings.GetRegValue("CheckForUpdates", true);
+ public bool collapseDeviceGroup = Settings.GetRegValue("CollapseDeviceGroups", true);
public Uri authLoginUrl = null;
public Process installProcess = null;
public string acceptableCertHash = null;
@@ -727,7 +728,7 @@ namespace MeshCentralRouter
}
}
- updateDeviceList(); // Update list of devices
+ updateDeviceList(false); // Update list of devices
addArgMappings();
reconnectUdpMaps();
@@ -749,7 +750,7 @@ namespace MeshCentralRouter
}
}
- private void updateDeviceList()
+ private void updateDeviceList(bool forceGroupChanged)
{
string search = searchTextBox.Text.ToLower();
if (deviceListViewMode)
@@ -757,7 +758,7 @@ namespace MeshCentralRouter
devicesListView.SuspendLayout();
devicesListView.Items.Clear();
- bool bGroupChanged = false;
+ bool bGroupChanged = forceGroupChanged;
ArrayList controlsToAdd = new ArrayList();
if (meshcentral.nodes != null)
{
@@ -850,8 +851,14 @@ namespace MeshCentralRouter
foreach (ListViewGroup lvg in devicesListView.Groups)
{
- ListViewExtended.setGrpState(lvg, ListViewGroupState.Collapsible | ListViewGroupState.Normal);
- //ListViewExtended.setGrpState(lvg, ListViewGroupState.Collapsible | ListViewGroupState.Collapsed);
+ if (collapseDeviceGroup)
+ {
+ ListViewExtended.setGrpState(lvg, ListViewGroupState.Collapsible | ListViewGroupState.Collapsed);
+ }
+ else
+ {
+ ListViewExtended.setGrpState(lvg, ListViewGroupState.Collapsible | ListViewGroupState.Normal);
+ }
}
}
@@ -1639,7 +1646,7 @@ namespace MeshCentralRouter
if (deviceListViewMode)
{
// Filter devices
- updateDeviceList();
+ updateDeviceList(false);
}
else
{
@@ -1813,14 +1820,14 @@ namespace MeshCentralRouter
{
showGroupNamesToolStripMenuItem.Checked = !showGroupNamesToolStripMenuItem.Checked;
Settings.SetRegValue("Show Group Names", showGroupNamesToolStripMenuItem.Checked ? "1" : "0");
- updateDeviceList();
+ updateDeviceList(false);
}
private void hideOfflineDevicesToolStripMenuItem_Click(object sender, EventArgs e)
{
showOfflineDevicesToolStripMenuItem.Checked = !showOfflineDevicesToolStripMenuItem.Checked;
Settings.SetRegValue("Show Offline Devices", showOfflineDevicesToolStripMenuItem.Checked ? "1" : "0");
- updateDeviceList();
+ updateDeviceList(false);
}
private void sortByNameToolStripMenuItem_Click(object sender, EventArgs e)
@@ -1828,7 +1835,7 @@ namespace MeshCentralRouter
sortByNameToolStripMenuItem.Checked = true;
sortByGroupToolStripMenuItem.Checked = false;
Settings.SetRegValue("Device Sort", "Name");
- updateDeviceList();
+ updateDeviceList(false);
}
private void sortByGroupToolStripMenuItem_Click(object sender, EventArgs e)
@@ -1836,7 +1843,7 @@ namespace MeshCentralRouter
sortByNameToolStripMenuItem.Checked = false;
sortByGroupToolStripMenuItem.Checked = true;
Settings.SetRegValue("Device Sort", "Group");
- updateDeviceList();
+ updateDeviceList(false);
}
private void installButton_Click(object sender, EventArgs e)
@@ -2209,9 +2216,13 @@ namespace MeshCentralRouter
f.Exp_KeyboardHookPriority = Settings.GetRegValue("Exp_KeyboardHookPriority", false);
f.Exp_KeyboardHook = Settings.GetRegValue("Exp_KeyboardHook", false);
f.CheckForUpdates = Settings.GetRegValue("CheckForUpdates", true);
+ collapseDeviceGroup = f.CollapseDeviceGroups = Settings.GetRegValue("CollapseDeviceGroups", true);
if (f.ShowDialog(this) == DialogResult.OK)
{
+ bool updateDevices = (collapseDeviceGroup != f.CollapseDeviceGroups);
+ collapseDeviceGroup = f.CollapseDeviceGroups;
+ Settings.SetRegValue("CollapseDeviceGroups", f.CollapseDeviceGroups);
Settings.SetRegValue("CheckForUpdates", f.CheckForUpdates);
Settings.SetRegValue("NotifyIcon", f.ShowSystemTray);
allowUpdates = f.CheckForUpdates;
@@ -2230,6 +2241,7 @@ namespace MeshCentralRouter
notifyIcon.Visible = false;
this.MinimizeBox = true;
}
+ if (updateDevices) { updateDeviceList(true); }
}
}