Beispiel #1
0
        //连接
        private void txButton1_Click(object sender, EventArgs e)
        {
            if (InternetGetConnectedState(out dwFlag, 0))
            {
                ShowToast_InSetup("提示", "网络已连接,请勿重新连接", 2);
                return;
            }

            if (myListBox1.SelectedItems.Count == 0)
            {
                return;
            }
            if (myListBox1.SelectedIndex == -1)
            {
                return;
            }

            Wlan.WlanAvailableNetwork wn = NetWorkList[myListBox1.SelectedIndex];
            if (wn.securityEnabled && !WlanHelper.HasProfile(WlanIface, WlanHelper.GetStringForSSID(wn.dot11Ssid)))
            {
                Form_Password fp = new Form_Password();
                if (fp.ShowDialog() == DialogResult.OK)
                {
                    string pw = fp.Password;

                    WlanHelper.ConnetWifi(WlanIface, wn, pw);
                    fp.Dispose();
                }
            }
            else
            {
                WlanHelper.ConnetWifi(WlanIface, wn);
            }
        }
Beispiel #2
0
        //连接
        private void txButton1_Click(object sender, EventArgs e)
        {
            if (myListBox1.SelectedIndex == -1)
            {
                return;
            }

            Wlan.WlanAvailableNetwork wn = NetWorkList[myListBox1.SelectedIndex];
            if (wn.securityEnabled && !WlanHelper.HasProfile(WlanIface, WlanHelper.GetStringForSSID(wn.dot11Ssid)))
            {
                Form_Password fp = new Form_Password();
                if (fp.ShowDialog() == DialogResult.OK)
                {
                    string pw = fp.Password;

                    WlanHelper.ConnetWifi(WlanIface, wn, pw);
                    fp.Dispose();
                }
            }
            else
            {
                WlanHelper.ConnetWifi(WlanIface, wn);
            }
        }