private void NewPanel_Click(object sender, EventArgs e) { if (!(sender as UIelements.NodePanel).Selected) { foreach (var a in NodeSelectPanel.Controls) { if (a is UIelements.NodePanel) { (a as UIelements.NodePanel).NodeUnselect(); } } (sender as UIelements.NodePanel).NodeSelect(); selectedNode = (sender as UIelements.NodePanel).Node; CoordXInput.Value = selectedNode.CoordinateY; CoordYInput.Value = selectedNode.CoordinateX; RemoveNode.Enabled = true; CoordXInput.Enabled = true; CoordYInput.Enabled = true; } else { TableWindow Tables = new TableWindow(selectedNode); Tables.Show(); } }
private void RemoveNode_Click(object sender, EventArgs e) { foreach (var a in NodeSelectPanel.Controls) { if (a is UIelements.NodePanel) { UIelements.NodePanel panel = (a as UIelements.NodePanel); if (panel.Selected) { panel.NodeUnselect(); selectedNode = null; NodeSelectPanel.Controls.Remove(panel); panel.Node.OnThresholdReached(panel.Node, new EventArgs()); RemoveNode.Enabled = false; CoordXInput.Enabled = false; CoordYInput.Enabled = false; CoordXInput.Value = 0; CoordYInput.Value = 0; } } } if (NodeSelectPanel.Controls.Count < 1) { RemoveNode.Enabled = false; } }
private void AddNodeButton_Click(object sender, EventArgs e) { if (NodeSelectPanel.Controls.Count < 20) { ODMRPelements.Node newNode = new ODMRPelements.Node(NodeSelectPanel.Controls) { CoordinateX = 0, CoordinateY = 0 }; UIelements.NodePanel newPanel = new UIelements.NodePanel(newNode); newPanel.Click += NewPanel_Click; NodeSelectPanel.Controls.Add(newPanel); NewPanel_Click(newPanel, new EventArgs()); newNode.OnThresholdReached(newNode, new EventArgs()); } if (NodeSelectPanel.Controls.Count > 0) { RemoveNode.Enabled = true; } }
public TableWindow(ODMRPelements.Node Node) { InitializeComponent(); foreach (var a in Node.RoutingTable) { SourcePanel.Controls.Add(new Label() { Text = a.SourceIp.ToString() }); NextHopPanel.Controls.Add(new Label() { Text = a.NextHop.ToString() }); } foreach (var a in Node.ForwardingTable) { MulticastPanel.Controls.Add(new Label() { Text = a.MulticastIp.ToString() }); } }