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!"); } }