mirror of
https://github.com/Ylianst/MeshCentralRouter
synced 2025-12-10 13:23:49 +00:00
Many improvements.
This commit is contained in:
@@ -1,12 +1,5 @@
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace MeshCentralRouter
|
||||
@@ -23,7 +16,7 @@ namespace MeshCentralRouter
|
||||
updateInfo();
|
||||
}
|
||||
|
||||
public string getRuleName() { return ruleNameTextBox.Text; }
|
||||
public string getName() { return nameTextBox.Text; }
|
||||
public int getProtocol() { return (int)(tcpRadioButton.Checked ? 1 : 2); }
|
||||
public int getLocalPort() { return (int)localNumericUpDown.Value; }
|
||||
public int getRemotePort() { return (int)remoteNumericUpDown.Value; }
|
||||
@@ -53,12 +46,34 @@ namespace MeshCentralRouter
|
||||
}
|
||||
}
|
||||
|
||||
// If the user has indivitual device rights, add an extra device group
|
||||
if (meshcentral.userRights != null)
|
||||
{
|
||||
bool indivitualDevices = false;
|
||||
foreach (string id in meshcentral.userRights.Keys) { if (id.StartsWith("node/")) { indivitualDevices = true; } }
|
||||
if (indivitualDevices)
|
||||
{
|
||||
MeshClass m = new MeshClass();
|
||||
m.name = Properties.Resources.IndividualDevices;
|
||||
groupComboBox.Items.Add(m);
|
||||
}
|
||||
}
|
||||
|
||||
// Set default selection
|
||||
if (groupComboBox.Items.Count > 0) { groupComboBox.SelectedIndex = 0; }
|
||||
appComboBox.SelectedIndex = 1;
|
||||
fillNodesInDropDown();
|
||||
} else {
|
||||
groupComboBox.Items.Add(selectedNode.mesh);
|
||||
if (selectedNode.mesh == null)
|
||||
{
|
||||
MeshClass m = new MeshClass();
|
||||
m.name = Properties.Resources.IndividualDevices;
|
||||
groupComboBox.Items.Add(m);
|
||||
}
|
||||
else
|
||||
{
|
||||
groupComboBox.Items.Add(selectedNode.mesh);
|
||||
}
|
||||
groupComboBox.SelectedIndex = 0;
|
||||
groupComboBox.Enabled = false;
|
||||
nodeComboBox.Items.Add(selectedNode);
|
||||
@@ -66,6 +81,7 @@ namespace MeshCentralRouter
|
||||
nodeComboBox.Enabled = false;
|
||||
appComboBox.SelectedIndex = 1;
|
||||
}
|
||||
nameTextBox.Focus();
|
||||
}
|
||||
|
||||
private void fillNodesInDropDown()
|
||||
@@ -75,10 +91,13 @@ namespace MeshCentralRouter
|
||||
|
||||
// Fill the nodes dropdown
|
||||
nodeComboBox.Items.Clear();
|
||||
foreach (string nodeid in meshcentral.nodes.Keys)
|
||||
if (meshcentral.nodes != null)
|
||||
{
|
||||
NodeClass node = meshcentral.nodes[nodeid];
|
||||
if ((node.meshid == mesh.meshid) && ((node.conn & 1) != 0)) { nodeComboBox.Items.Add(node); }
|
||||
foreach (string nodeid in meshcentral.nodes.Keys)
|
||||
{
|
||||
NodeClass node = meshcentral.nodes[nodeid];
|
||||
if (((node.meshid == mesh.meshid) || ((mesh.meshid == null) && (meshcentral.userRights.ContainsKey(node.nodeid)))) && ((node.conn & 1) != 0)) { nodeComboBox.Items.Add(node); }
|
||||
}
|
||||
}
|
||||
|
||||
if (nodeComboBox.Items.Count > 0) { nodeComboBox.SelectedIndex = 0; }
|
||||
|
||||
Reference in New Issue
Block a user