public override void SetFormState(Form form) { form.MaximizeBox = false; form.MinimizeBox = false; form.TopMost = true; form.ShowInTaskbar = true; form.FormClosing += (sender, e) => { if (form.DialogResult == DialogResult.OK) { try { string hashPassword = null; if (SecurtiyService == null) { throw new Exception("安全服务还未初始化"); } if (TextEditPassword.Text.IsNotNullOrEmpty()) { hashPassword = SecurityPublic.ComputeHashString(TextEditPassword.Text); } var userID = SecurtiyService.Login(TextEditUser.Text, hashPassword); SecurityPublic.ApplicationUser = new UserToken() { UserID = userID, }; } catch (Exception err) { UIPublic.ShowExceptionDialog(err); e.Cancel = true; } } }; base.SetFormState(form); }
private void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e) { UIPublic.ShowExceptionDialog(e.Exception); }