public SystemEditor(NSHG.Network network, NSHG.System s, MainWindow parent) { InitializeComponent(); sys = s; this.network = network; this.parent = parent; UpdateView(); }
private void SelectSystemButton_Click(object sender, RoutedEventArgs e) { if (NetworkLoaded && Systems.SelectedItem != null) { BasicSys sys = (BasicSys)Systems.SelectedItem; NSHG.System s = network.Systems[uint.Parse(sys.ID)]; Frame.Content = null; Frame.Content = new Editor(network, s, this); } }
public void Read1() { NSHG.System s1; NSHG.System s2 = null; Dictionary <MAC, NetworkInterface> a = new Dictionary <MAC, NetworkInterface>(); MAC mac = MAC.Parse("FF:FF:FF:FF:FF:FF"); string name = "Adapter 1"; IP localip = IP.Parse("192.168.1.2"); IP Subnet = IP.Parse("255.255.255.0"); IP DefaultG = IP.Parse("192.168.1.1"); IP DNS = IP.Parse("1.1.1.1"); a.Add(mac, new Adapter(mac, 1, name, localip, Subnet, DefaultG, DNS, 1, true)); s1 = new NSHG.System(1, a, false); XmlDocument doc = new XmlDocument(); doc.Load("XMLFile.xml"); foreach (XmlNode node in doc.DocumentElement) { if (node.Name == "SystemRead1") { foreach (XmlNode n in node.ChildNodes) { if (n.Name == "System") { s2 = NSHG.System.FromXML(n); } } } } Network net = Network.NewNet(); net.Systems.Add(s1.ID, s1); net.SaveNetwork("sys1.xml", null); Assert.True(s1.Equals(s2)); }
public Editor(NSHG.Network network, NSHG.System s, MainWindow parent) { InitializeComponent(); switch (s.GetType().ToString()) { case "NSHG.System": Frame.Content = new SystemEditor(network, s, parent); break; case "NSHG.Router": Frame.Content = new SystemEditor(network, s, parent); break; default: Frame.Content = new Label() { Content = "Error Reading System Type" }; break; } }