mirror of
https://github.com/Ylianst/MeshCentralRouter
synced 2025-12-06 00:13:33 +00:00
Fixed individual devices, #46
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<StartupObject>MeshCentralRouter.Program</StartupObject>
|
||||
<ApplicationIcon>src\MeshServer.ico</ApplicationIcon>
|
||||
<ApplicationIcon>MeshServer.ico</ApplicationIcon>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<OldToolsVersion>3.5</OldToolsVersion>
|
||||
@@ -58,6 +58,7 @@
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup />
|
||||
<PropertyGroup>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
</PropertyGroup>
|
||||
@@ -415,6 +416,7 @@
|
||||
<None Include="app.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="MeshServer.ico" />
|
||||
<Content Include="src\MeshServer.ico" />
|
||||
<None Include="readme.md" />
|
||||
<None Include="Resources\icon-monitor1.png" />
|
||||
|
||||
BIN
MeshServer.ico
Normal file
BIN
MeshServer.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 99 KiB |
@@ -530,7 +530,7 @@ namespace MeshCentralRouter
|
||||
{
|
||||
string host = serverNameComboBox.Text;
|
||||
int i = host.IndexOf("?key=");
|
||||
if (i >= 0) { host = host.Substring(0, i); }
|
||||
if (i >= 0) { host = host.Substring(0, i); }
|
||||
i = host.IndexOf(":");
|
||||
if (i >= 0) { host = host.Substring(0, i); }
|
||||
ok = (Program.LockToHostname == host);
|
||||
@@ -710,15 +710,15 @@ namespace MeshCentralRouter
|
||||
}
|
||||
}
|
||||
|
||||
class GroupComparer : IComparer
|
||||
{
|
||||
public int Compare(object objA, object objB)
|
||||
{
|
||||
return ((ListViewGroup)objA).Header.CompareTo(((ListViewGroup)objB).Header);
|
||||
}
|
||||
}
|
||||
class GroupComparer : IComparer
|
||||
{
|
||||
public int Compare(object objA, object objB)
|
||||
{
|
||||
return ((ListViewGroup)objA).Header.CompareTo(((ListViewGroup)objB).Header);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateDeviceList()
|
||||
private void updateDeviceList()
|
||||
{
|
||||
string search = searchTextBox.Text.ToLower();
|
||||
if (deviceListViewMode)
|
||||
@@ -731,6 +731,7 @@ namespace MeshCentralRouter
|
||||
{
|
||||
foreach (NodeClass node in meshcentral.nodes.Values)
|
||||
{
|
||||
|
||||
if (node.agentid == -1) { continue; }
|
||||
ListViewItem device;
|
||||
if (node.listitem == null)
|
||||
@@ -748,51 +749,57 @@ namespace MeshCentralRouter
|
||||
}
|
||||
|
||||
if ((node.meshid != null) && meshcentral.meshes.ContainsKey(node.meshid)) { node.mesh = (MeshClass)meshcentral.meshes[node.meshid]; }
|
||||
string meshName = (node.mesh != null) ? node.mesh.name : Properties.Resources.IndividualDevices;
|
||||
|
||||
if ((showGroupNamesToolStripMenuItem.Checked) && (node.mesh != null))
|
||||
{
|
||||
device.SubItems[0].Text = node.mesh.name + " - " + node.name;
|
||||
device.SubItems[0].Text = meshName + " - " + node.name;
|
||||
}
|
||||
else
|
||||
{
|
||||
device.SubItems[0].Text = node.name;
|
||||
}
|
||||
|
||||
// *** Flynn Grouping start
|
||||
bool bGroupExisting = false;
|
||||
for(int i = 0; i < devicesListView.Groups.Count; i++)
|
||||
if(devicesListView.Groups[i].Header == node.mesh.name)
|
||||
{
|
||||
bGroupExisting = true;
|
||||
node.listitem.Group = devicesListView.Groups[i];
|
||||
break;
|
||||
}
|
||||
if(!bGroupExisting)
|
||||
{
|
||||
ListViewGroup grp = devicesListView.Groups.Add(devicesListView.Groups.Count.ToString(), node.mesh.name);
|
||||
node.listitem.Group = grp;
|
||||
// *** Flynn Grouping start
|
||||
bool bGroupExisting = false;
|
||||
for (int i = 0; i < devicesListView.Groups.Count; i++)
|
||||
{
|
||||
if (devicesListView.Groups[i].Header == meshName)
|
||||
{
|
||||
bGroupExisting = true;
|
||||
node.listitem.Group = devicesListView.Groups[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ListViewGroup[] groups = new ListViewGroup[this.devicesListView.Groups.Count];
|
||||
if (!bGroupExisting)
|
||||
{
|
||||
ListViewGroup grp = devicesListView.Groups.Add(devicesListView.Groups.Count.ToString(), meshName);
|
||||
node.listitem.Group = grp;
|
||||
ListViewGroup[] groups = new ListViewGroup[this.devicesListView.Groups.Count];
|
||||
this.devicesListView.Groups.CopyTo(groups, 0);
|
||||
Array.Sort(groups, new GroupComparer());
|
||||
|
||||
this.devicesListView.Groups.CopyTo(groups, 0);
|
||||
this.devicesListView.BeginUpdate();
|
||||
this.devicesListView.Groups.Clear();
|
||||
this.devicesListView.Groups.AddRange(groups);
|
||||
this.devicesListView.EndUpdate();
|
||||
|
||||
Array.Sort(groups, new GroupComparer());
|
||||
foreach (ListViewGroup lvg in devicesListView.Groups)
|
||||
{
|
||||
if (lvg.Header == "Repos")
|
||||
{
|
||||
ListViewExtended.setGrpState(lvg, ListViewGroupState.Collapsible | ListViewGroupState.Normal);
|
||||
}
|
||||
else
|
||||
{
|
||||
ListViewExtended.setGrpState(lvg, ListViewGroupState.Collapsible | ListViewGroupState.Collapsed);
|
||||
}
|
||||
}
|
||||
}
|
||||
// *** Flynn Grouping end
|
||||
|
||||
this.devicesListView.BeginUpdate();
|
||||
this.devicesListView.Groups.Clear();
|
||||
this.devicesListView.Groups.AddRange(groups);
|
||||
this.devicesListView.EndUpdate();
|
||||
|
||||
foreach(ListViewGroup lvg in devicesListView.Groups)
|
||||
{
|
||||
if(lvg.Header == "Repos")
|
||||
ListViewExtended.setGrpState(lvg, ListViewGroupState.Collapsible | ListViewGroupState.Normal);
|
||||
else
|
||||
ListViewExtended.setGrpState(lvg, ListViewGroupState.Collapsible | ListViewGroupState.Collapsed);
|
||||
}
|
||||
}
|
||||
// *** Flynn Groupng end
|
||||
|
||||
bool connVisible = ((showOfflineDevicesToolStripMenuItem.Checked) || ((node.conn & 1) != 0)) || (node.mtype == 3);
|
||||
bool connVisible = ((showOfflineDevicesToolStripMenuItem.Checked) || ((node.conn & 1) != 0)) || (node.mtype == 3);
|
||||
int imageIndex = (node.icon - 1) * 2;
|
||||
if (((node.conn & 1) == 0) && (node.mtype != 3)) { imageIndex++; }
|
||||
device.ImageIndex = imageIndex;
|
||||
@@ -2220,13 +2227,14 @@ namespace MeshCentralRouter
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
ConnectionSettings form = new ConnectionSettings();
|
||||
if (form.ShowDialog(this) == DialogResult.OK) { }
|
||||
if (form.ShowDialog(this) == DialogResult.OK) { }
|
||||
}
|
||||
|
||||
private void customAppsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
CustomAppsForm f = new CustomAppsForm(Settings.GetApplications());
|
||||
if (f.ShowDialog(this) == DialogResult.OK) {
|
||||
if (f.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
Settings.SetApplications(f.getApplications());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user