// Select network: private void com_network_name_SelectionChanged(object sender, SelectionChangedEventArgs e) { _mianWinsow.ClearExperment(); string networkName = (com_network_name.SelectedItem as ComboBoxItem).Content.ToString(); PublicParamerters.NetworkName = networkName; // clear: InmportedSensors.Clear(); comb_sink_node.Items.Clear(); comb_source_node.Items.Clear(); // add new: InmportedSensors = NetworkTopolgy.ImportNetwok(networkName); foreach (ImportedSensor sen in InmportedSensors) { comb_sink_node.Items.Add(new ComboBoxItem() { Content = sen.NodeID }); comb_source_node.Items.Add(new ComboBoxItem() { Content = sen.NodeID }); } PublicParamerters.CommunicationRangeRadius = InmportedSensors[0].R; comb_sink_node.Text = "0"; }
/// <summary> /// deplay the nodes /// </summary> /// <param name="netname"></param> private void Deploy(string netname) { NetwokImport im = new NetwokImport(); im.MainWindow = mainWindow; im.ImportedSensorSensors = NetworkTopolgy.ImportNetwok(netname); im.Deploy(netname); }
// Select network: private void com_network_name_SelectionChanged(object sender, SelectionChangedEventArgs e) { _mianWinsow.ClearExperment(); com_zone_width_control.Items.Clear(); string networkName = (com_network_name.SelectedItem as ComboBoxItem).Content.ToString(); PublicParamerters.NetworkName = networkName; // clear: InmportedSensors.Clear(); comb_sink_node.Items.Clear(); comb_source_node.Items.Clear(); // add new: InmportedSensors = NetworkTopolgy.ImportNetwok(networkName); foreach (ImportedSensor sen in InmportedSensors) { comb_sink_node.Items.Add(new ComboBoxItem() { Content = sen.NodeID }); comb_source_node.Items.Add(new ComboBoxItem() { Content = sen.NodeID }); } PublicParamerters.SensingRangeRadius = InmportedSensors[0].R; comb_sink_node.Text = "0"; for (int i = Convert.ToInt16(PublicParamerters.SensingRangeRadius / 2); i <= 3 * PublicParamerters.SensingRangeRadius; i++) { com_zone_width_control.Items.Add(new ComboBoxItem() { Content = i }); } com_zone_width_control.Text = Settings.Default.ZoneWidth.ToString(); }