Exemplo n.º 1
0
 public async Task <bool> IsWpsPushButtonAvailableAsync()
 {
     return(await Task.Run(async() =>
     {
         await Task.CompletedTask;
         if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 5, 0))
         {
             var task = adapter.GetWpsConfigurationAsync(availableNetwork).AsTask();
             bool success = task.Wait(1000);
             if (success)
             {
                 if (task.Result.SupportedWpsKinds.Contains(WiFiWpsKind.PushButton))
                 {
                     return true;
                 }
                 else
                 {
                     return false;
                 }
             }
             else
             {
                 // GetWpsConfigurationAsync is not returning sometimes
                 // If the result isn't available let the user figure out if WPS is supported or not
                 Log.Trace($"GetWpsConfigurationAsync timed out: {availableNetwork.Ssid}");
                 return true;
             }
         }
         return false;
     }));
 }
        public async Task <bool> IsWpsPushButtonAvailableAsync()
        {
            if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 5, 0))
            {
                var result = await adapter.GetWpsConfigurationAsync(AvailableNetwork);

                if (result.SupportedWpsKinds.Contains(WiFiWpsKind.PushButton))
                {
                    return(true);
                }
            }

            return(false);
        }