private void remoteAutoStart() { debugBox.AppendText("**************\r\n自动启动即将生效\r\n***********************"); RegistryKey registerAutoStart = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true); registerAutoStart.DeleteValue("HuFamilyWifi"); debugBox.AppendText(Environment.NewLine + HostedNetwork.SetHostedNetwork(ssidTextbox.Text, passwdTextbox.Text)); debugBox.AppendText(Environment.NewLine + HostedNetwork.SetStatus(enableCheckbox.Checked)); }
private void addAutoStart() { debugBox.AppendText("**************\r\n自动启动即将生效,5秒后将应用相关设置\r\n**************"); Thread.Sleep(5000); RegistryKey registerAutoStart = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true); registerAutoStart.SetValue("HuFamilyWifi", Application.ExecutablePath); debugBox.AppendText(Environment.NewLine + HostedNetwork.SetHostedNetwork(ssidTextbox.Text, passwdTextbox.Text)); debugBox.AppendText(Environment.NewLine + HostedNetwork.SetStatus(enableCheckbox.Checked)); }
private void setButton_Click(object sender, EventArgs e) { if (ssidTextbox.Text != "") { debugBox.AppendText(Environment.NewLine + HostedNetwork.SetHostedNetwork(ssidTextbox.Text, passwdTextbox.Text)); debugBox.AppendText(Environment.NewLine + HostedNetwork.SetStatus(enableCheckbox.Checked)); LocalSetting.WriteSetting(ssidTextbox.Text, passwdTextbox.Text, enableCheckbox.Checked, autoStartCheckbox.Checked); MessageBox.Show("设置信息已写入,请检查右边的调试信息是否正确!", "设置成功", MessageBoxButtons.OK); } else { MessageBox.Show("SSID填写不正确,可能是未填写或存在非法字符!", "SSID错误", MessageBoxButtons.OK); } }