Beispiel #1
0
        private void brn_import_Click(object sender, RoutedEventArgs e)
        {
            NetworkTopolgy.ImportNetwok(this);
            PublicParameters.NetworkName        = lbl_network_name.Content.ToString();
            PublicParameters.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);


                node.ShowID(Settings.Default.ShowID);
                node.ShowSensingRange(Settings.Default.ShowSensingRange);
                node.ShowComunicationRange(Settings.Default.ShowComunicationRange);
                node.ShowBattery(Settings.Default.ShowBattry);
            }


            try
            {
                UiImportTopology.Close();
            }
            catch
            {
            }
        }
Beispiel #2
0
        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!");
            }
        }