private async void Form1_Load(object sender, EventArgs e) { labelAddr.Text = ""; labelIP.Text = ""; labelSuccess.Text = ""; this.notifyIcon1.Icon = Properties.Resources.IconNotConnected; this.Icon = Properties.Resources.IconConnected; SEUConfig newConfig = new SEUConfig(); newConfig.ReadConfig(); checkBoxAutoLogin.Checked = newConfig.bAutoLog; checkBoxSavePwd.Checked = newConfig.bSavePwd; textBoxStuID.Text = newConfig.StuID; seuUser.StuID = newConfig.StuID; textBoxPwd.Text = newConfig.Pwd; seuUser.Pwd = newConfig.Pwd; //this.Hide(); if (newConfig.bAutoLog) { await SEUFooLogin(seuUser); //this.Hide(); } if (newConfig.StuID == "0")// { this.WindowState = FormWindowState.Normal; } else { this.WindowState = FormWindowState.Minimized; this.ShowInTaskbar = false; this.Hide(); } }
private async void buttonLogin_Click(object sender, EventArgs e) { bool bSavePwd = checkBoxSavePwd.Checked; bool bAutoLogin = checkBoxAutoLogin.Checked; seuUser = new SEUUser(textBoxStuID.Text, textBoxPwd.Text); SEUConfig newConfig = new SEUConfig(); newConfig.StuID = seuUser.StuID; newConfig.Pwd = seuUser.Pwd; newConfig.bSavePwd = bSavePwd; newConfig.bAutoLog = bAutoLogin; var netStatus = await SEUFooLogin(seuUser); if(netStatus.error == null) { newConfig.SaveToJson();//登录成功,帐号密码,配置参数保存到磁盘 } }