void processLogin() { LoginLayout loginLayout = new LoginLayout(); loginLayout.ShowDialog(); string type = loginLayout.type; user = loginLayout.username; if (type == "0") { pnControls.Controls.Clear(); pnControls.Controls.Add(btnLogOut); pnControls.Controls.Add(btnChangePass); pnControls.Controls.Add(btnImport); pnControls.Controls.Add(bntBroadGrade); pnControls.Controls.Add(btnTKB); pnControls.Controls.Add(btnListCourse); pnControls.Controls.Add(bntAddStudent); pnControls.Controls.Add(lbLogo); } else if (type == "1") { pnControls.Controls.Clear(); pnControls.Controls.Add(btnLogOut); pnControls.Controls.Add(btnChangePass); pnControls.Controls.Add(btnGradeStudent); pnControls.Controls.Add(lbLogo); } else { Close(); } }
public void ApplicationStart(object sender, StartupEventArgs e) { Current.ShutdownMode = ShutdownMode.OnExplicitShutdown; //MainWindow mainWindow = new MainWindow(); LoginLayout login = new LoginLayout(); Current.ShutdownMode = ShutdownMode.OnLastWindowClose; login.ShowDialog(); //mainWindow.Show(); }
private void login() { /** * 登录框启动 * */ LoginLayout login = new LoginLayout(); login.ShowDialog(); if (login.DialogResult == DialogResult.OK) { user = login.User; } else { System.Environment.Exit(0); } if (user == null) { MessageBox.Show("非法登录"); System.Environment.Exit(0); } }