private void lvWifiList_MouseDoubleClick(object sender, MouseEventArgs e) { if (lvWifiList.SelectedIndices != null && lvWifiList.SelectedItems.Count > 0) { ListView.SelectedIndexCollection c = lvWifiList.SelectedIndices; MessageBoxButtons messButton = MessageBoxButtons.OKCancel; DialogResult dr = MessageBox.Show("确定要连接" + lvWifiList.Items[c[0]].Text + "吗?", "wifi连接", messButton); if (dr == DialogResult.OK)//如果点击“确定”按钮 { string pwd = ""; PasswordUI pwdInput = new PasswordUI(); if (pwdInput.ShowDialog() == System.Windows.Forms.DialogResult.OK) { //取输入的密码 pwd = pwdInput.TextObj.Text; //连接wifi try { ConnectToWifi(lvWifiList.Items[c[0]].SubItems[2].Text, lvWifiList.Items[c[0]].Text, pwd); } catch (Exception ex) { MessageBox.Show("连接wifi出错!"); } } } } }
private void ibSetting_Click(object sender, EventArgs e) { PasswordUI pf = new PasswordUI(); if (pf.ShowDialog() == System.Windows.Forms.DialogResult.OK && pf.TextObj.Text.Equals(SuperObject.Config.ManagerPassword)) { ConfigUI sc = new ConfigUI(); sc.ShowDialog(); } }