public JoystickButtonAxis(GamepadButton negative, GamepadButton positive) { m_negative = negative; m_positive = positive; m_sourceInfo = new SourceInfo(ControlNames.GetName(m_positive) + "-" + ControlNames.GetName(m_negative), SourceType.Joystick); }
/// <summary> /// 去除控件点击事件 /// </summary> /// <param name="controlName">控件名</param> public void RemoveContorlClickMethod(ControlNames controlName) { Control control = GetControlByName(controlName); if (control == null) { return; } //下面是复制代码,不知原理 BindingFlags mPropertyFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic; BindingFlags mFieldFlags = BindingFlags.Static | BindingFlags.NonPublic; Type controlType = typeof(System.Windows.Forms.Control); PropertyInfo propertyInfo = controlType.GetProperty("Events", mPropertyFlags); EventHandlerList eventHandlerList = (EventHandlerList)propertyInfo.GetValue(control, null); FieldInfo fieldInfo = (typeof(Control)).GetField("EventClick", mFieldFlags); Delegate d = eventHandlerList[fieldInfo.GetValue(control)]; if (d == null) { return; } EventInfo eventInfo = controlType.GetEvent("Click"); foreach (Delegate dx in d.GetInvocationList()) { eventInfo.RemoveEventHandler(control, dx); } }
public ValidationErrorMessage(string controlName, string message) { Message = message; if (controlName != null) { ControlNames.Add(controlName); } }
/// <summary> /// Called once per frame /// </summary> protected override void FixedUpdate() { var xMovement = Input.GetAxis(ControlNames.GetAxisName(Axises.Horizontal, this.PlayerIndex)); var isJumping = Input.GetButton(ControlNames.GetButtonName(Buttons.Jump, this.PlayerIndex)); this.Mech.Move(xMovement, isJumping); base.FixedUpdate(); }
/// <summary> /// Shows the message. /// </summary> /// <param name="message">The message.</param> /// <param name="controlName">Name of the control.</param> public void ShowMessage(string message, ControlNames controlName) { if (!string.IsNullOrEmpty(message)) { ErrorMessageTextBlock.Text = message; ErrorMessageTextBlock.Visibility = Visibility.Visible; switch (controlName) { case ControlNames.ConfirmPassword: { ConfirmPasswordBox.DelayedFocus(); break; } case ControlNames.Password: { PasswordBox.DelayedFocus(); break; } case ControlNames.ZipCode: { ZipCodeTextBox.DelayedFocus(); break; } case ControlNames.LastName: { LastNameTextBox.DelayedFocus(); break; } case ControlNames.FirstName: { FirstNameTextBox.DelayedFocus(); break; } case ControlNames.Email: { EmailTextBox.DelayedFocus(); break; } case ControlNames.GetEmail: { GetEmailCheckBox.DelayedFocus(); break; } } } else { ErrorMessageTextBlock.Visibility = Visibility.Collapsed; } }
/// <summary> /// 增加控件点击事件 /// </summary> /// <param name="function">函数名</param> /// <param name="controlName">控件名</param> public void AddContorlClickMethod(functionDelegate function, ControlNames controlName) { Control control = GetControlByName(controlName); if (control == null) { return; } control.Click += new EventHandler(function); }
/// <summary> /// 控件启用/弃用 /// </summary> /// <param name="controlName">控件名</param> public void ContorlEnabledChange(ControlNames controlName) { Control control = GetControlByName(controlName); if (control == null) { return; } control.Enabled = control.Enabled ? false : true; }
private Control GetControlByName(ControlNames controlName) { switch (controlName) { case ControlNames.addButton: { return(addButton); } case ControlNames.changeButton: { return(changeButton); } case ControlNames.createButton: { return(createButton); } case ControlNames.emptyButton: { return(emptyButton); } case ControlNames.exitButton: { return(exitButton); } case ControlNames.helpButton: { return(helpButton); } case ControlNames.nextButton: { return(nextButton); } case ControlNames.previousButton: { return(previousButton); } case ControlNames.saveButton: { return(saveButton); } default: { return(null); } } }
internal IControlDefaultPropertyBag ReadDefaultConfiguration(ControlNames controlName) { IControlDefaultPropertyBag defaultConfig = ControlLibraryConfig.ControlConfigReader.GetControlDefaultsValues(controlName); return defaultConfig; }
internal IControlDefaultPropertyBag ReadDefaultConfiguration(ControlNames controlName) { IControlDefaultPropertyBag defaultConfig = ControlLibraryConfig.ControlConfigReader.GetControlDefaultsValues(controlName); return(defaultConfig); }
public void PopControl() { ControlNames.Pop(); Name = string.Join(Environment.NewLine, ControlNames.ToArray().Reverse()); }
public void PushControl(string name) { ControlNames.Push(name); Name = string.Join(Environment.NewLine, ControlNames.ToArray().Reverse()); }
public ControlDefaultPropertyBag GetControlDefaultsValues(ControlNames controlName) { return ControlPropertyConfigurationCache.GetDefaultPropertyBag(controlName.ToString()); }
public ControlDefaultPropertyBag GetControlDefaultsValues(ControlNames controlName) { return(ControlPropertyConfigurationCache.GetDefaultPropertyBag(controlName.ToString())); }