/// <summary> /// 关闭窗口时保存数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Form_Main_FormClosing(object sender, System.Windows.Forms.FormClosingEventArgs e) { SaveUsersData(rtUserPath); tcpServerLogin.Stop(); tcpServerBookEvau.Stop(); System.Environment.Exit(0); }
/// <summary> /// 关闭窗口时保存数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Form_Login_FormClosing(object sender, System.Windows.Forms.FormClosingEventArgs e) { tcpClientLogin.Close(); tcpListenerUser.Stop(); if (this.textBox_UesrAccount.Text == null) { return; } string lastUser = this.textBox_UesrAccount.Text; Registry.AddKey2Registry("PublishClient", "LastUser", lastUser); }
private void Form_Main_FormClosing(object sender, System.Windows.Forms.FormClosingEventArgs e) { if (TryLogoff()) { MessageBox.Show("登出成功", "Success", MessageBoxButtons.OK); } else { MessageBox.Show("登出失败", "Fail", MessageBoxButtons.OK); } tcpClientLogoff.Close(); tcpServerGet.Stop(); }