private void button2_Click(object sender, EventArgs e) { GC.Collect(); PasswordForm passwordForm = new PasswordForm(); passwordForm.ShowDialog(); if (passwordForm.DialogResult == DialogResult.OK) { passwordForm.Dispose(); GC.Collect(); ChangePasswordForm changePassword = new ChangePasswordForm(); changePassword.Show(); return; } else if (passwordForm.DialogResult == DialogResult.No) { MessageBox.Show("用户名或密码错误!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else if (passwordForm.DialogResult == DialogResult.Cancel) { passwordForm.Dispose(); GC.Collect(); return; } }
static void Main() { #if DEBUG if (DateTime.Now.Date.Year != 2020 || DateTime.Now.Date.Month > 11) { MessageBox.Show("本软件是未完成版本,功能可能不完善!\r\n请联系开发者获取完整版本!", "软件过期", MessageBoxButtons.OK, MessageBoxIcon.Error); Environment.Exit(-1); } #endif Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); PasswordForm passwordForm = new PasswordForm(); passwordForm.ShowDialog(); if (passwordForm.DialogResult == DialogResult.OK) { passwordForm.Dispose(); GC.Collect(); Application.Run(new MainForm()); } else { passwordForm.Dispose(); GC.Collect(); Application.Exit(); } }