private void regionComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (initialSelect) { initialSelect = false; } else { string newRegion = ((ComboBoxItem)regionComboBox.SelectedItem).Label; if (vpnControl.isConnected()) { // get animation going wantsConnect = true; OnPropertyChanged("wantsConnect"); isConnecting = true; OnPropertyChanged("isConnecting"); bluePowerCenter.Visibility = Visibility.Hidden; } new System.Threading.Thread(() => { reconnect = false; if (vpnControl.isConnected()) { reconnect = true; vpnControl.disconnectFromVPN(); } vpnControl.switchServer(newRegion); Properties.Settings.Default.region = newRegion; Properties.Settings.Default.Save(); if (reconnect) { vpnControl.connectToVPN(); reconnect = false; } }).Start(); } }