private void KeyEnterPressedEvent(object sender, KeyPressEventArgs args) { if (args.KeyChar.Equals((char)Keys.Enter)) { AuthorizeButton.PerformClick(); } }
private void BoxesKeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar.Equals((char)Keys.Enter)) { AuthorizeButton.PerformClick(); } }
/// <summary> /// 获取页面操作按钮权限 /// </summary> /// <param name="keyName">页面名称关键字</param> /// <returns></returns> public List <AuthorizeButton> GetAuthorizeButtons(List <Button> buttons, string keyName) { var list = new List <AuthorizeButton>(); foreach (var button in buttons) { var authorizeButton = new AuthorizeButton(); authorizeButton.text = button.Name; authorizeButton.iconCls = button.Icon; switch (button.Code) { case "add": authorizeButton.handler = string.Format("Add{0}()", keyName); break; case "save": authorizeButton.handler = string.Format("Update{0}()", keyName); break; case "cut": authorizeButton.handler = string.Format("Del{0}()", keyName); break; default: authorizeButton.handler = button.Code + "()"; break; } list.Add(authorizeButton); } return(list); }
public AuthForm(IKernel kernel) : this() { AuthDialogResult = false; TunellProxy.ServiceAddress = kernel.Get <ISettingsInject>().GetServiceName(); message = kernel.Get <IMessageInject>(); mapper = kernel.Get <IMapperInject>(); memory = kernel.Get <IMemoryInject>(); BackColor = FormBrushes.WindowBackGroundColor; ForeColor = FormBrushes.WindowForegroundColor; Font = FormBrushes.DefaultRegularFont; AuthorizeButton.SetDefaultColor(); CancelButton.SetDefaultColor(); Icon = Resources.main_icon; AuthorizeButton.Enabled = false; #if DEBUG LoginTE.Text = "admin"; PasswordTE.Text = "admin"; PasswordTE.Properties.UseSystemPasswordChar = true; AuthorizeButton.Enabled = true; AuthorizeButton.Select(); #endif LoginTE.TextChanged += TextChangedEvent; PasswordTE.TextChanged += TextChangedEvent; LoginTE.KeyPress += KeyEnterPressedEvent; PasswordTE.KeyPress += KeyEnterPressedEvent; AuthorizeButton.Click += AuthorizeButtonClick; MouseDown += AuthFormMouseDown; }