Esempio n. 1
0
 async void SetNetWorkAdapterEnabeldAsync()
 {
     await Task.Run(new Action(() =>
     {
         try
         {
             if (!IsEnabledWifi)
             {
                 System.Windows.Application.Current.Dispatcher.Invoke(new Action(() =>
                 {
                     if (AccessPointList.Count > 0)
                     {
                         AccessPointList.Clear();
                     }
                 }));
             }
             GetpotentialAdapter();
             NetWorkAdapter.SetNetWorkAdapterEnabeld(CurrentWifiAdapter, IsEnabledWifi);
             CheckWifiIsEnabled(700);
         }
         catch (Exception ex)
         { }
         finally
         {
             IsRunning = false;
         }
     }));
 }
Esempio n. 2
0
 /// <summary>
 /// 检测wifi开启状态
 /// </summary>
 /// <param name="isEnabledWifi"></param>
 void CheckWifiIsEnabled(bool isEnabledWifi)
 {
     if (isEnabledWifi)
     {
         ListAll();
     }
     else
     {
         System.Windows.Application.Current.Dispatcher.Invoke(new Action(() =>
         {
             if (AccessPointList.Count > 0)
             {
                 AccessPointList.Clear();
             }
         }));
     }
 }