Exemple #1
0
        private void ProcessValues(byte[] message)
        {
            if (message.IsButton())
            {
                var oldValue = Buttons[message.GetAddress()];
                var newValue = message.IsButtonPressed();

                if (oldValue != newValue)
                {
                    Buttons[message.GetAddress()] = message.IsButtonPressed();
                    ButtonChanged?.Invoke(this, new ButtonEventArgs {
                        Button = message.GetAddress(), Pressed = newValue
                    });
                }
            }
            else if (message.IsAxis())
            {
                var oldValue = Axis[message.GetAddress()];
                var newValue = message.GetAxisValue();

                if (oldValue != newValue)
                {
                    Axis[message.GetAddress()] = message.GetAxisValue();
                    AxisChanged?.Invoke(this, new AxisEventArgs {
                        Axis = message.GetAddress(), Value = newValue
                    });
                }
            }
        }
Exemple #2
0
        protected void HandleMultiButton_Click(object sender, EventArgs e)
        {
            if (Current != null)
            {
                Current.BackColor = Color.FromArgb(20, 20, 20);
                Current.ForeColor = Color.Silver;
            }
            var btn = sender as Button;

            if (btn != null)
            {
                btn.BackColor = Color.FromArgb(86, 105, 53);
                btn.ForeColor = Color.FromArgb(136, 234, 17);
                Current       = btn;

                // Trigger event
                ButtonChanged?.Invoke(sender, e);
            }
        }