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);
        }
예제 #2
0
        /// <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);
            }
        }
예제 #3
0
        public ValidationErrorMessage(string controlName, string message)
        {
            Message = message;

            if (controlName != null)
            {
                ControlNames.Add(controlName);
            }
        }
예제 #4
0
        /// <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();
        }
예제 #5
0
        /// <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;
            }
        }
예제 #6
0
        /// <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);
        }
예제 #7
0
        /// <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;
        }
예제 #8
0
        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);
            }
            }
        }
예제 #9
0
 internal IControlDefaultPropertyBag ReadDefaultConfiguration(ControlNames controlName)
 {
     IControlDefaultPropertyBag defaultConfig = ControlLibraryConfig.ControlConfigReader.GetControlDefaultsValues(controlName);
     return defaultConfig;
 }
예제 #10
0
        internal IControlDefaultPropertyBag ReadDefaultConfiguration(ControlNames controlName)
        {
            IControlDefaultPropertyBag defaultConfig = ControlLibraryConfig.ControlConfigReader.GetControlDefaultsValues(controlName);

            return(defaultConfig);
        }
예제 #11
0
 public void PopControl()
 {
     ControlNames.Pop();
     Name = string.Join(Environment.NewLine, ControlNames.ToArray().Reverse());
 }
예제 #12
0
 public void PushControl(string name)
 {
     ControlNames.Push(name);
     Name = string.Join(Environment.NewLine, ControlNames.ToArray().Reverse());
 }
예제 #13
0
 public ControlDefaultPropertyBag GetControlDefaultsValues(ControlNames controlName)
 {
     return ControlPropertyConfigurationCache.GetDefaultPropertyBag(controlName.ToString());
 }
예제 #14
0
 public ControlDefaultPropertyBag GetControlDefaultsValues(ControlNames controlName)
 {
     return(ControlPropertyConfigurationCache.GetDefaultPropertyBag(controlName.ToString()));
 }