Example #1
0
        private WifiAccessPoint GetCurrentWifiConnection()
        {
            WlanClient client = new WlanClient();

            foreach (WlanClient.WlanInterface wlanIface in client.Interfaces)
            {
                // Subscribe to events on this interface.
                if (WlanInterface == null)
                {
                    WlanInterface = wlanIface;
                }

                if (wlanIface.InterfaceState == Wlan.WlanInterfaceState.Connected)
                {
                    try
                    {
                        return(new WifiAccessPoint(WlanInterface.CurrentConnection.profileName, WlanInterface.CurrentConnection.wlanAssociationAttributes.dot11BssType));
                    }
                    catch (Win32Exception ex)
                    {
                        Error.LastError = ex.ToString();
                    }
                }

                break;
            }

            return(WifiAccessPoint.NotConnected);
        }
Example #2
0
        static public Scan ScanWifiSignals(WifiInterface wifiInterface)
        {
            List <Reading> readingList = new List <Reading>();
            Scan           scan        = new Scan(DateTime.UtcNow, readingList);

            if (wifiInterface != null && !String.IsNullOrEmpty(wifiInterface.ID))
            {
                try
                {
                    WlanClient.WlanInterface wlanIface      = GetNetworkInterfaceFromId(wifiInterface.ID);
                    Wlan.WlanBssEntry[]      wlanBssEntries = wlanIface.GetNetworkBssList();
                    foreach (Wlan.WlanBssEntry wlanBssEntry in wlanBssEntries)
                    {
                        string mac  = ConvertAddressBytesToString(wlanBssEntry.dot11Bssid);
                        string ssid = Encoding.ASCII.GetString(wlanBssEntry.dot11Ssid.SSID, 0, (int)wlanBssEntry.dot11Ssid.SSIDLength);
                        int    rssi = wlanBssEntry.rssi;
                        if (rssi > 0)
                        {
                            rssi -= 255;
                        }
                        Reading reading = new Reading(mac, ssid, rssi);

                        readingList.Add(reading);
                    }
                    readingList.Sort();
                }
                catch
                {
                    // Do nothing.
                }
            }
            return(scan);
        }
Example #3
0
        public static void AddProfiles(ListView lst, WlanClient.WlanInterface wlanIface)
        {
            lst.Groups.Clear();
            lst.Items.Clear();

            foreach (Wlan.WlanProfileInfo profileInfo in wlanIface.GetProfiles())
            {
                if (string.IsNullOrEmpty(profileInfo.profileName))
                {
                    continue;
                }

                XmlSerializer deserializer = new XmlSerializer(typeof(WLANProfile));
                object        profile      = null;
                using (TextReader reader = new StringReader(wlanIface.GetProfileXmlUnencrypted(profileInfo.profileName)))
                {
                    profile = deserializer.Deserialize(reader);
                }

                if (profile == null)
                {
                    continue;
                }

                AddProfilesInformation(lst, (WLANProfile)profile);
            }
        }
Example #4
0
        private void StartWifi()
        {
            WlanClient client = new WlanClient();

            try
            {
                if (client.Interfaces == null)
                {
                    WifiName = "wifi 未连接";
                }
                else
                {
                    WlanClient.WlanInterface wlan = client.Interfaces[0];

                    string wifi = wlan.CurrentConnection.profileName;
                    Wlan.WlanInterfaceState wifistate = wlan.CurrentConnection.isState;
                    if (Wlan.WlanInterfaceState.Connected == wifistate)
                    {
                        WifiName = wifi;//wifi成功连接

                        string ControlIp = Utilities.ReadIni("ControlUrl", "controlUrl", "");
                        string Port      = Utilities.ReadIni("Port", "port", "");
                        controlType = InitWIFISocket(ControlIp, Port) ? 0 : 2;
                        if (0 == controlType)
                        {
                            InitHeartPackage();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                string msg = ex.Message;
            }
        }
Example #5
0
        /// <summary>
        /// 一键连接wifi网络
        /// </summary>
        /// <param name="network">加密网络</param>
        /// <param name="password">密码</param>
        public static void ConnetWifi(WlanClient.WlanInterface wlanIface, Wlan.WlanAvailableNetwork network, string password)
        {
            string profile = GetStringForSSID(network.dot11Ssid);

            if (password != null)
            {
                string hex            = StringToHex(profile);
                string authentication = GetAuthentication(network.dot11DefaultAuthAlgorithm);
                string authEncryption = GetEncryption(network.dot11DefaultCipherAlgorithm);
                string keytype        = GetKeyType(authEncryption);
                string profileXml     = string.Format("<?xml version=\"1.0\"?><WLANProfile xmlns=\"http://www.microsoft.com/networking/WLAN/profile/v1\"><name>{0}</name><SSIDConfig><SSID><hex>{1}</hex><name>{0}</name></SSID></SSIDConfig><connectionType>ESS</connectionType><connectionMode>auto</connectionMode><MSM><security><authEncryption><authentication>{2}</authentication><encryption>{3}</encryption><useOneX>false</useOneX></authEncryption><sharedKey><keyType>{4}</keyType><protected>false</protected><keyMaterial>{5}</keyMaterial></sharedKey></security></MSM></WLANProfile>", profile, hex, authentication, authEncryption, keytype, password);
                wlanIface.SetProfile(Wlan.WlanProfileFlags.AllUser, profileXml, true);
                wlanIface.Connect(Wlan.WlanConnectionMode.Profile, Wlan.Dot11BssType.Any, profile);
            }
            else
            {
                //有profile的加密连接,直接连
                if (network.securityEnabled)
                {
                    wlanIface.Connect(Wlan.WlanConnectionMode.Profile, Wlan.Dot11BssType.Any, profile);
                }
                else
                {
                    string hex        = StringToHex(profile);
                    string profileXml = string.Format("<?xml version=\"1.0\"?><WLANProfile xmlns=\"http://www.microsoft.com/networking/WLAN/profile/v1\"><name>{0}</name><SSIDConfig><SSID><hex>{1}</hex><name>{0}</name></SSID></SSIDConfig><connectionType>ESS</connectionType><connectionMode>auto</connectionMode><MSM><security><authEncryption><authentication>open</authentication><encryption>none</encryption><useOneX>false</useOneX></authEncryption></security></MSM></WLANProfile>", profile, hex);
                    wlanIface.SetProfile(Wlan.WlanProfileFlags.AllUser, profileXml, true);
                    wlanIface.Connect(Wlan.WlanConnectionMode.Profile, Wlan.Dot11BssType.Any, profile);
                }
            }
        }
Example #6
0
        private void LstInterfaces_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
        {
            if (lstInterfaces.SelectedItems.Count > 0)
            {
                if (!tabOptions.Enabled)
                {
                    tabOptions.Enabled = true;
                }

                ListViewItem item = lstInterfaces.SelectedItems[0];
                if (item.Tag != null && item.Tag.GetType() == typeof(WlanClient.WlanInterface))
                {
                    WlanClient.WlanInterface wlanIface = item.Tag as WlanClient.WlanInterface;
                    InterfaceInfo.AddDeviceInformation(lstInterfaceInformation, wlanIface);
                    Profile.AddProfiles(lstProfiles, wlanIface);
                    Network.AddNetworks(tblNetworks, wlanIface);
                    Statistics.AddStatisticsInformation(lstStatistics, wlanIface);

#if !DEBUG
                    lstInterfaceInformation.SetGroupState(ListViewGroupCollapse.ListViewGroupState.Collapsible);
                    lstProfiles.SetGroupState(ListViewGroupCollapse.ListViewGroupState.Collapsible);
                    lstInterfaceInformation.SetGroupState(ListViewGroupCollapse.ListViewGroupState.Collapsible);
                    lstStatistics.SetGroupState(ListViewGroupCollapse.ListViewGroupState.Collapsible);
#endif
                }
            }
            else
            {
                tabOptions.Enabled = false;
                lstInterfaceInformation.Groups.Clear();
                lstInterfaceInformation.Items.Clear();
                tblNetworks.Rows.Clear();
            }
        }
Example #7
0
 private void wlanInterfaceTmp_WlanConnectionNotification(Wlan.WlanNotificationData notifyData, Wlan.WlanConnectionNotificationData connNotifyData)
 {
     if (connNotifyData.profileName != "")
     {
         WlanClient wlanClientTmp = new WlanClient();
         WlanClient.WlanInterface wlanInterfaceTmp = wlanClientTmp.Interfaces[0];
         Dispatcher.Invoke(() =>
         {
             List <Object> dataList = GetAvailableNetworkList1();
             if (dataList == null)
             {
                 return;
             }
             dataGridWlan1.ItemsSource = dataList;
             if (wlanInterfaceTmp.IsWlanConnection())
             {
                 Wlan.WlanConnectionAttributes wlanAttr = wlanInterfaceTmp.CurrentConnection;
                 if (wlanAttr.isState == Wlan.WlanInterfaceState.Connected)
                 {
                     string macAddress = GetMacAddress(wlanAttr.wlanAssociationAttributes.dot11Bssid);
                     tbState.Text      = String.Format("当前设备已连接到Wlan: {0}, Mac地址: {1} IPv4地址: {2}", wlanAttr.profileName, macAddress, PathUtil.GetIPv4());
                 }
             }
         });
     }
 }
Example #8
0
        static void Main()
        {
            Application.EnableVisualStyles();

            OpenMainWindow();

            settings    = new Settings();
            wlan_client = new WlanClient();

            wlan_intr = wlan_client.Interfaces[0];
            wlan_intr.WlanNotification += WlanNotification;

            ContextMenuStrip menu = new System.Windows.Forms.ContextMenuStrip();

            menu.Items.Add("Abrir control...", null, OpenWindow);
            menu.Items.Add("Salir", null, CloseProgram);

            icon                   = new NotifyIcon();
            icon.Icon              = window.Icon;
            icon.Text              = "FlashAir Control se ejecuta en segundo plano.";
            icon.ContextMenuStrip  = menu;
            icon.MouseDoubleClick += IconClick;
            icon.Visible           = true;

            StartSyncAuto();
            NetworkChange.NetworkAvailabilityChanged += NetChange;

            Application.Run();
        }
Example #9
0
        static public List <WifiSignalStrength> ScanForSignalStrengths(WifiInterface wifiInterface)
        {
            List <WifiSignalStrength> signalStrengthList = new List <WifiSignalStrength>();

            if (wifiInterface != null && !String.IsNullOrEmpty(wifiInterface.ID))
            {
                try
                {
                    WlanClient.WlanInterface wlanIface      = GetNetworkInterfaceFromId(wifiInterface.ID);
                    Wlan.WlanBssEntry[]      wlanBssEntries = wlanIface.GetNetworkBssList();
                    foreach (Wlan.WlanBssEntry wlanBssEntry in wlanBssEntries)
                    {
                        string mac  = ConvertAddressBytesToString(wlanBssEntry.dot11Bssid);
                        string ssid = Encoding.ASCII.GetString(wlanBssEntry.dot11Ssid.SSID, 0, (int)wlanBssEntry.dot11Ssid.SSIDLength);
                        int    rssi = wlanBssEntry.rssi;
                        if (rssi > 0)
                        {
                            rssi -= 255;
                        }
                        WifiSignalStrength signalStrength = new WifiSignalStrength(ssid, mac, rssi);
                        signalStrengthList.Add(signalStrength);
                    }
                    signalStrengthList.Sort();
                }
                catch
                {
                    // Do nothing.
                }
            }
            return(signalStrengthList);
        }
Example #10
0
        private static void AddDeviceNetworkInformation(ListView lst, WlanClient.WlanInterface wlanIface)
        {
            ListViewGroup groupNetwork = new ListViewGroup("Network");

            lst.Groups.Add(groupNetwork);

            List <ListViewItem> networkItems = new List <ListViewItem>
            {
                Utils.MakeKeyValueItem("Name", wlanIface.NetworkInterface.Name, groupNetwork),
                Utils.MakeKeyValueItem("Description", wlanIface.NetworkInterface.Description, groupNetwork),
                Utils.MakeKeyValueItem("MAC", wlanIface.NetworkInterface.GetPhysicalAddress().ToString(), groupNetwork),
                Utils.MakeKeyValueItem("Status", wlanIface.NetworkInterface.OperationalStatus.ToString(), groupNetwork),
                Utils.MakeKeyValueItem("Id", wlanIface.NetworkInterface.Id, groupNetwork),
                Utils.MakeKeyValueItem("Type", wlanIface.NetworkInterface.NetworkInterfaceType.ToString(), groupNetwork),
                Utils.MakeKeyValueItem("Supports multicast?", wlanIface.NetworkInterface.SupportsMulticast ? "YES" : "NO", groupNetwork),
            };

            if (wlanIface.NetworkInterface.Speed > 0)
            {
                networkItems.Add(
                    Utils.MakeKeyValueItem("Speed", $"{(wlanIface.NetworkInterface.Speed / 1000000)}  Mbps", groupNetwork)
                    );
            }

            lst.Items.AddRange(networkItems.ToArray());
        }
Example #11
0
        static void SetInterface()
        {
            while (true)
            {
                if (client.Interfaces.Length == 1)
                {
                    Console.WriteLine("There's only one interface.");
                    Console.ForegroundColor = ConsoleColor.Cyan;
                    Interface = client.Interfaces[0];
                    Console.WriteLine("Interface [0] " + Interface.InterfaceName + " selected");
                    Console.ForegroundColor = ConsoleColor.Gray;
                    break;
                }

                GetInterface();

                Console.Write("Type ID to select or leave empty to update: ");
                string result = Console.ReadLine();
                if (result.Length != 0)
                {
                    Interface = client.Interfaces[int.Parse(result)];
                    Console.ForegroundColor = ConsoleColor.Cyan;
                    Console.WriteLine(String.Format("Interface [{0}] {1} selected", int.Parse(result), Interface.InterfaceName));
                    Console.ForegroundColor = ConsoleColor.Gray;
                    break;
                }
            }
        }
Example #12
0
        //开始扫描
        private void button_scan_Click(object sender, EventArgs e)
        {
            //找到当前的wlan设备
            client = new WlanClient();

            if (client.Interfaces.Length == 0)
            {
                MessageBox.Show("未找到无线网卡!");
                return;
            }
            //找到第一个wlan设备
            wlanIface = client.Interfaces[0];
            //开始扫描
            timer_scan.Interval = 1000;
            timer_scan.Start();


            //foreach (WlanClient.WlanInterface wlanIface in client.Interfaces)
            //{
            //    Wlan.WlanBssEntry[] bssworks = wlanIface.GetNetworkBssList();
            //    foreach (Wlan.WlanBssEntry bsswork in bssworks)
            //    {
            //        str = SsidToString(bsswork.dot11Ssid);
            //        Console.WriteLine(str);
            //        Console.WriteLine(BitConverter.ToString(bsswork.dot11Bssid));
            //        Console.WriteLine(bsswork.rssi);
            //        Console.WriteLine();

            //    }
            //}
            button_scan.Enabled = false;
            button_scan.Text    = "扫描中...";
        }
Example #13
0
        /// <summary>
        /// Getting Wifi Details
        /// </summary>
        static void GetConnectedWifiDetails()
        {
            try
            {
                //instantiating Wlan Client Object
                WlanClient client = new WlanClient();
                WlanClient.WlanInterface WlanIface = client.Interfaces[0];
                string State           = WlanIface.CurrentConnection.isState.ToString();
                string ProfileName     = WlanIface.CurrentConnection.profileName;
                var    physicalAddress = WlanIface.CurrentConnection.wlanAssociationAttributes.Dot11Bssid;
                byte[] McAddr          = WlanIface.CurrentConnection.wlanAssociationAttributes.dot11Bssid;

                string Mac = "";
                for (int i = 0; i < McAddr.Length; i++)
                {
                    Mac += McAddr[i].ToString("x2").PadLeft(2, '0').ToUpper();
                }

                //Printing Wifi Fetched Details
                Console.WriteLine("Wifi Name:" + ProfileName + "\n");
                Console.WriteLine("Wifi MAC:" + Mac + "\n");
                Console.WriteLine("Wifi State:" + State + "\n");
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error Occoured" + ex.Message);
            }
        }
        static void SelectCurrentWifi(Wlan.WlanAvailableNetwork network, WlanClient.WlanInterface wlanIface)
        {
            string name = GetStringForSSID(network.dot11Ssid);
            string xml  = "";

            foreach (Wlan.WlanProfileInfo profileInfo in wlanIface.GetProfiles())
            {
                if (profileInfo.profileName == name) // this is typically the network's SSID
                {
                    xml = wlanIface.GetProfileXml(name);
                }
                else
                {
                    if (network.dot11DefaultCipherAlgorithm == Wlan.Dot11CipherAlgorithm.None)
                    {
                        SelectWifiWithNoKey(name, ref wlanIface);
                    }
                    else
                    {
                        Console.WriteLine("没有WiFiProfile信息,请先创建登录信息");
                    }

                    //Console.ReadKey();
                }
            }
        }
Example #15
0
        // Assume the SSID is first command line argument
        static void Main(string[] args)
        {
            WlanClient client = new WlanClient();

            if (client.Interfaces.Length > 1)
            {
                Console.WriteLine("ERROR: More than one WiFi interface. Must specify which one! Implementation TODO");
                Environment.Exit(0);
            }
            else if (client.Interfaces.Length == 0)
            {
                Console.WriteLine("ERROR: No WiFi interfaces found.");
                Environment.Exit(0);
            }

            WlanClient.WlanInterface wlanIface = client.Interfaces[0];
            String openWifiSSID = args[0];

            ConnectToOpenWifiNetwork(wlanIface, openWifiSSID);

            /*
             * ListAvailableNetworks(wlanIface);
             * ArrayList openSSIDs = GetAvailableOpenWifiNetworkSSIDs(wlanIface);
             *
             * // Connect to the first one
             * String openSSID_str = openSSIDs[0].ToString();
             * ConnectToOpenWifiNetwork(wlanIface, openSSID_str);
             */
        }
Example #16
0
        private void Form1_Load(object sender, EventArgs e)
        {
            WlanClient client = new WlanClient();

            WlanIface = client.Interfaces[0];//一般就一个网卡,有2个没试过。
            WlanIface.WlanConnectionNotification += WlanIface_WlanConnectionNotification;
            LoadNetWork();
        }
Example #17
0
        // Connects to an Open WiFi Network based on it's SSID (profileName)
        // Note that an "Open Wifi Network" is one without a CipherAlgorithm
        static void ConnectToOpenWifiNetwork(WlanClient.WlanInterface wlanIface, string profileName)
        {
            string profileXml = String.Format("<?xml version=\"1.0\"?><WLANProfile xmlns=\"http://www.microsoft.com/networking/WLAN/profile/v1\"><name>{0}</name><SSIDConfig><SSID><name>{0}</name></SSID></SSIDConfig><connectionType>ESS</connectionType><MSM><security><authEncryption><authentication>open</authentication><encryption>none</encryption><useOneX>false</useOneX></authEncryption></security></MSM></WLANProfile>", profileName);

            wlanIface.SetProfile(Wlan.WlanProfileFlags.AllUser, profileXml, true);
            wlanIface.Connect(Wlan.WlanConnectionMode.Profile, Wlan.Dot11BssType.Any, profileName);
            Console.WriteLine("Attempted to connect to network with SSID {0}", profileName);
        }
Example #18
0
        public InterfaceModel(WlanClient.WlanInterface interFace)
        {
            this.interFace = interFace;

#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
            UpdateInformation();
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
        }
Example #19
0
        public static void AddDeviceInformation(ListView lst, WlanClient.WlanInterface wlanIface)
        {
            lst.Groups.Clear();
            lst.Items.Clear();

            AddDeviceNetworkInformation(lst, wlanIface);
            AddDeviceInterfaceInformation(lst, wlanIface);
        }
Example #20
0
 static void ListAvailableNetworks(WlanClient.WlanInterface wlanIface)
 {
     // Lists all available networks
     Wlan.WlanAvailableNetwork[] networks = GetAvailableWifiNetworks(wlanIface); // = wlanIface.GetAvailableNetworkList( 0 );
     foreach (Wlan.WlanAvailableNetwork network in networks)
     {
         Console.WriteLine("Found network with SSID {0} with cipher algorithm: {1}", GetStringForSSID(network.dot11Ssid), network.dot11DefaultCipherAlgorithm);
     }
 }
Example #21
0
        private void Form1_Load(object sender, EventArgs e)
        {
            WlanClient client = new WlanClient();

            WlanIface = client.Interfaces[0];//一般就一个网卡,有2个没试过。

            Tick(sender, e);
            this.TimerCounter.Start();
        }
        private bool IsSentByCorrectNetworkInterface(Wlan.WlanNotificationData notificationData)
        {
            WlanClient.WlanInterface wifiInterface = GetInterfaceByInterfaceId(notificationData.interfaceGuid);
            if (wifiInterface == currentWifiInterface)
            {
                return(true);
            }

            return(false);
        }
        private void ResetProgressVariables()
        {
            currentState = DroneNetworkConnectionState.NotConnected;

            currentPingRetries = 0;
            currentScanRetries = 0;
            currentlyScannedNetworkInterfaceNumber = -1;

            currentWifiInterface = null;
        }
Example #24
0
        public static bool IsConnectedToNetwork()
        {
            WlanClient client = new WlanClient();

            WlanClient.WlanInterface wlanIface = client.Interfaces[0];
            if (wlanIface.InterfaceState == Wlan.WlanInterfaceState.Connected)
            {
                return(true);
            }
            return(false);
        }
Example #25
0
        public void ScanNetworks()
        {
            networkClient = new WlanClient(new Wlan.WlanNotificationCallbackDelegate(this.OnWlanNotification));

            foreach (WlanClient.WlanInterface wlanIface in networkClient.Interfaces)
            {
                // Lists all available networks
                networkInterface = wlanIface;
                networkInterface.Scan();
            }
        }
        private bool DetermineNextNetworkInterface()
        {
            currentlyScannedNetworkInterfaceNumber++;
            if (currentlyScannedNetworkInterfaceNumber >= client.Interfaces.Length)
            {
                ProcessConnectionFailed();
                return(false);
            }

            currentWifiInterface = client.Interfaces[currentlyScannedNetworkInterfaceNumber];
            return(true);
        }
        private static void SelectWifiWithNoKey(string name, ref WlanClient.WlanInterface wlanIface)
        {
            // Connects to a known network with WEP security
            string profileName = name;                     // this is also the SSID
            string mac         = StringToHex(profileName); //

            //string key = "";
            string myProfileXML = string.Format("<?xml version=\"1.0\"?><WLANProfile xmlns=\"http://www.microsoft.com/networking/WLAN/profile/v1\"><name>{0}</name><SSIDConfig><SSID><hex>{1}</hex><name>{0}</name></SSID></SSIDConfig><connectionType>ESS</connectionType><connectionMode>manual</connectionMode><MSM><security><authEncryption><authentication>open</authentication><encryption>none</encryption><useOneX>false</useOneX></authEncryption></security></MSM></WLANProfile>", profileName, mac);

            wlanIface.SetProfile(Wlan.WlanProfileFlags.AllUser, myProfileXML, true);
            wlanIface.Connect(Wlan.WlanConnectionMode.Profile, Wlan.Dot11BssType.Any, profileName);
        }
Example #28
0
 /// <summary>
 /// 是否有身份配置,有就直接连接了,不用输入什么密码了
 /// </summary>
 /// <param name="wlanIface"></param>
 /// <param name="profile"></param>
 /// <returns></returns>
 public static bool HasProfile(WlanClient.WlanInterface wlanIface, string profile)
 {
     Wlan.WlanProfileInfo[] p = wlanIface.GetProfiles();
     foreach (Wlan.WlanProfileInfo item in p)
     {
         if (item.profileName == profile)
         {
             return(true);
         }
     }
     return(false);
 }
Example #29
0
 public void setInterface(int ifaceIndex)
 {
     INTERFAZ = client.Interfaces[ifaceIndex];
     System.Net.NetworkInformation.NetworkInterface[] lista_ethernets = System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces();
     foreach (NetworkInterface EtherIface in lista_ethernets)
     {
         if (INTERFAZ.InterfaceGuid.CompareTo(new Guid(EtherIface.Id)) == 0)
         {
             IfaceEthernet = EtherIface;
             break;
         }
     }
 }
Example #30
0
        private void init()
        {
            client    = new WlanClient();
            WlanIface = client.Interfaces[0];//一般就一个网卡,有2个没试过。
            //if(client.Interfaces[0].info.isState == NativeWifi.Wlan.WlanInterfaceState.Connected)
            //{

            //}
            WlanIface.WlanConnectionNotification += WlanIface_WlanConnectionNotification;


            LoadNetWork();
        }