private void Window_KeyUp(object sender, KeyEventArgs e) { if (e.Key == Key.F5) { var mainWindow = new MainWindow(); mainWindow.Show(); this.Close(); } }
void updateLoginButton(bool isLogined) { if (isLogined) { this.btnLogin.Content = "已登录"; ConfigManager.Config.Username = _username; ConfigManager.Config.Password = _password.Encode(); ConfigManager.SaveConfig(); var mainWindow = new MainWindow(); mainWindow.Show(); this.Close(); } else { this.cmbUsername.IsReadOnly = false; this.txtPassword.IsEnabled = true; this.btnLogin.IsEnabled = true; this.btnLogin.Content = "登录"; MessageBox.Show("登录失败!"); } }