/// <summary> /// Load properties of a hardwarenode for editing in the PropertyConfigControl /// </summary> /// <param name="ElementName"></param> public void LoadElementProperties(string ElementName) { selectedNode = NetworkManager.Instance.GetHardwarenodeByName(ElementName); propertyControl.ClearControls(); if (selectedNode is Workstation) { var station = selectedNode as Workstation; // load workstation ethernet interface config controls foreach (var eth in station.Interfaces) { propertyControl.AddInterfaceConfigControl(eth.Name, eth.IpAddress, eth.Subnetmask); } // Set InterfaceList in RouteConfigControl RouteConfigControl.SetInterfaces(station.Interfaces.Select(i => i.Name).ToList()); // load route controls foreach (var route in station.GetRoutes()) { propertyControl.AddRouteConfigControl(route.Name, route.Destination, route.Gateway, route.Subnetmask, route.Iface.Name); } // load workstation Layerstack controls propertyControl.AddLayerStackConfigControl(); foreach (ILayer layer in station.Layerstack.GetAllLayers()) { propertyControl.AddLayerToLayerConfigControl(layer.GetLayerName(), layer is CustomLayer); } GwConfigControl.SetInterfaces(station.Interfaces.Select(i => i.Name).ToList()); if (selectedNode is Router) { // load gateway config control propertyControl.AddGatewayConfigControl(station.StandardGateway ?? IPAddress.None, station.StandardGatewayPort?.Name, true, (selectedNode as Router).IsGateway); } else { propertyControl.AddGatewayConfigControl(station.StandardGateway ?? IPAddress.None, station.StandardGatewayPort?.Name, false); } propertyControl.DisplayElements(); } else if (selectedNode is Switch) { Switch selectedSwitch = selectedNode as Switch; propertyControl.AddSwitchConfigControl(selectedSwitch.GetInterfaceCount()); } }