示例#1
0
 public FiProfile(WLANProfile profile)
 {
     available = false;
     if (profiled = profile != null)
     {
         SSID       = profile.name;
         Strength   = 0;
         Security   = profile.MSM.security.authEncryption.authentication;
         Encryption = profile.MSM.security.authEncryption.encryption;
         connected  = false;
     }
 }
 public async Task <bool> ConnectNetworkTaskAsync(Network network, string password)
 {
     try
     {
         ProfileXml = new WLANProfile(password, network);
         ProfileXml.SaveAsync();
         return(await AddProfile());
     }
     catch (Exception)
     {
         return(false);
     }
 }
        public static WLANProfile CreateProfile()
        {
            WLANProfile _profile = new WLANProfile();

            _profile.SSIDConfig                  = new SSIDConfig();
            _profile.SSIDConfig.SSID             = new SSID();
            _profile.MSM                         = new MSM();
            _profile.MSM.security                = new security();
            _profile.MSM.security.authEncryption = new authEncryption();
            _profile.MSM.security.sharedKey      = new sharedKey();

            return(_profile);
        }
        public async Task <bool> ConnectNetworkTaskAsync(string SSID, string password)
        {
            try
            {
                var listAll = await GetNetworksAsync();

                var selectedNet = listAll.Where(e => e.SSID == SSID).FirstOrDefault();
                ProfileXml = new WLANProfile(password, selectedNet);
                ProfileXml.SaveAsync();
                return(await AddProfile());
            }
            catch (Exception)
            {
                return(false);
            }
        }