Example #1
0
 public static void SetStateForWifiOrAddNewWifi(string ssid, WifiPopup.WifiConnectionResult action)
 {
     if (WifiHelpers.CheckIfKnownSsidsContainsSsid(ssid))
     {
         WifiHelpers.MutateKnownSsid(ssid, action);
         return;
     }
     WifiHelpers.AddNewWifi(ssid, action);
 }
Example #2
0
        public static void MutateKnownSsid(string ssid, WifiPopup.WifiConnectionResult action)
        {
            try
            {
                if (SettingsHolder.get_Settings().get_KnownSsids() == null)
                {
                    SettingsHolder.get_Settings().set_KnownSsids(new ObservableCollection <SsidItem>());
                }
                bool flag = false;
                ObservableCollection <SsidItem> knownSsids = SettingsHolder.get_Settings().get_KnownSsids();
                lock (knownSsids)
                {
                    foreach (SsidItem current in SettingsHolder.get_Settings().get_KnownSsids())
                    {
                        if (current != null && current.get_Ssid().Equals(ssid))
                        {
                            if (action == WifiPopup.WifiConnectionResult.Always)
                            {
                                current.set_Action(2);
                            }
                            else if (action == WifiPopup.WifiConnectionResult.Never)
                            {
                                current.set_Action(0);
                            }
                            else
                            {
                                if (action != WifiPopup.WifiConnectionResult.Ask)
                                {
                                    if (action != WifiPopup.WifiConnectionResult.Once)
                                    {
                                        if (action == WifiPopup.WifiConnectionResult.Disconnect)
                                        {
                                            current.set_Action(3);
                                            goto IL_9B;
                                        }
                                        goto IL_9B;
                                    }
                                }
                                current.set_Action(1);
                            }
IL_9B:
                            flag = true;
                        }
                    }
                }
                if (!flag)
                {
                    WifiHelpers.AddNewWifi(ssid, action);
                }
            }
            catch (Exception ex)
            {
                HelperFunctions.DebugLine(string.Format("Exception in MutateKnownSsid could not get entry EX: {0}", ex.Message));
            }
        }
Example #3
0
 public static void SetStateForWifiOrAddNewWifi(string ssid, string action)
 {
     WifiPopup.WifiConnectionResult action2 = WifiPopup.WifiConnectionResult.Ask;
     if (!(action == "ask"))
     {
         if (!(action == "disconnect"))
         {
             if (!(action == "always"))
             {
                 if (!(action == "never"))
                 {
                     if (action == "once")
                     {
                         action2 = WifiPopup.WifiConnectionResult.Once;
                     }
                 }
                 else
                 {
                     action2 = WifiPopup.WifiConnectionResult.Never;
                 }
             }
             else
             {
                 action2 = WifiPopup.WifiConnectionResult.Always;
             }
         }
         else
         {
             action2 = WifiPopup.WifiConnectionResult.Disconnect;
         }
     }
     else
     {
         action2 = WifiPopup.WifiConnectionResult.Ask;
     }
     WifiHelpers.SetStateForWifiOrAddNewWifi(ssid, action2);
 }