private void SetWifiSettingToCombobox(string thisWifi) { SsidAction settingForSsid = WifiHelpers.GetSettingForSsid(thisWifi); this.HotspotComboBox.SelectedIndex = 2; if (settingForSsid == 2) { this.HotspotComboBox.SelectedIndex = 0; return; } if (settingForSsid == null) { this.HotspotComboBox.SelectedIndex = 1; return; } if (settingForSsid == 1) { this.HotspotComboBox.SelectedIndex = 2; return; } if (settingForSsid == 3) { this.HotspotComboBox.SelectedIndex = 3; } }
public static SsidAction GetSettingForSsid(string wifiSsid) { SsidAction result = 1; try { if (SettingsHolder.get_Settings().get_KnownSsids() != null) { ObservableCollection <SsidItem> knownSsids = SettingsHolder.get_Settings().get_KnownSsids(); lock (knownSsids) { foreach (SsidItem current in SettingsHolder.get_Settings().get_KnownSsids()) { try { if (current != null) { if (current.get_Ssid().Equals(wifiSsid)) { return(current.get_Action()); } } } catch (Exception ex) { HelperFunctions.DebugLine(string.Format("Exception in GetSettingForSsid could not get entry EX: {0}", ex.Message)); } } } string hotspotProtection = SettingsHolder.get_Settings().get_ProfileWifi().get_HotspotProtection(); if (!(hotspotProtection == "off")) { if (!(hotspotProtection == "auto")) { if (hotspotProtection == "ask") { result = 1; } } else { result = 2; } } else { result = 0; } } else { SettingsHolder.get_Settings().set_KnownSsids(new ObservableCollection <SsidItem>()); } } catch (Exception ex2) { HelperFunctions.DebugLine(string.Format("Exception in GetSettingForSsid EX: {0}", ex2.Message)); } return(result); }