private void brn_import_Click(object sender, RoutedEventArgs e) { NetworkTopolgy.ImportNetwok(this); Parameters.PublicParamerters.NetworkName = lbl_network_name.Content.ToString(); Parameters.PublicParamerters.SensingRangeRadius = ImportedSensorSensors[0].R; // now add them to feild. foreach (ImportedSensor imsensor in ImportedSensorSensors) { Sensor node = new Sensor(imsensor.NodeID); node.MainWindow = MainWindow; Point p = new Point(imsensor.Pox, imsensor.Poy); node.Position = p; node.VisualizedRadius = imsensor.R; MainWindow.myNetWork.Add(node); MainWindow.Canvas_SensingFeild.Children.Add(node); } try { UiImportTopology.Close(); } catch { } }
public UiImportTopology(MainWindow MainWindow) { InitializeComponent(); foreach (NetwokImport net in NetworkTopolgy.ImportNetworkNames(this)) { net.MainWindow = MainWindow; stk_netwoks.Children.Add(net); } }
private void Button_Click(object sender, RoutedEventArgs e) { NetworkTopolgy topolog = new NetworkTopolgy(); bool isExisted = topolog.createNewTopology(txt_networkName.Text); if (!isExisted) { this.WindowState = WindowState.Minimized; foreach (Sensor sensor in myNetWork) { topolog.SaveSensor(sensor, txt_networkName.Text); } this.Close(); } else { MessageBox.Show("please change network name!"); } }