Пример #1
0
 /// <summary>
 /// Raises the <see cref="E:KeyPadButton"/> event.
 /// </summary>
 /// <param name="e">The <see cref="LaJust.PowerMeter.Communications.KeyPadButtonEventArgs"/> instance containing the event data.</param>
 protected virtual void OnPanelButtonPressed(PanelButtonEventData e)
 {
     EventHandler<PanelButtonEventData> handler = PanelButtonPressed;
     try
     {
         handler(this, e);
     }
     catch (Exception ex)
     {
         Trace.TraceError("{0}.OnPanelButtonPressed: {1}", CLASSNAME, ex.GetBaseException());
     }
 }
Пример #2
0
        /// <summary>
        /// Handles the PanelButtonPressed event of the Receiver control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="LaJust.PowerMeter.Communications.PanelButtonEventArgs"/> instance containing the event data.</param>
        private void Receiver_PanelButtonPressed(object sender, PanelButtonEventData e)
        {
            IReceiver receiver = e.Receiver;
            PanelButtons button = e.Button;

            // Used to keep monitor from going into suspend when we have receiver activity
            Helpers.ActivitySimulator.MoveMouse();

            _logger.Log("Publishing receiver button pushed event to EventAggregator", Category.Info, Priority.Low);
            _eventAggregator.GetEvent<ReceiverEvents.ButtonPressed>().Publish(
                    (ReceiverEvents.PanelButtons)Enum.Parse(typeof(ReceiverEvents.PanelButtons), button.ToString(), true));


            // FIXME: Move this code to the game engine module
            bool contactSensorRequired = _config.ContactSensorRequired;

            if (button == PanelButtons.ChungRegister)
            {
                receiver.RegisterDevice(new RegistrationSettings()
                {
                    TouchSensorMode = contactSensorRequired ? TouchSensorStatusEnum.Required : TouchSensorStatusEnum.NotRequired,
                    OpCode = OpCodeCmds.RegisterChung,
                    GameNumber = 1,
                    MinimumPressure = 10
                });
            }
            else if (button == PanelButtons.HongRegister)
            {
                receiver.RegisterDevice(new RegistrationSettings()
                {
                    TouchSensorMode = contactSensorRequired ? TouchSensorStatusEnum.Required : TouchSensorStatusEnum.NotRequired,
                    OpCode = OpCodeCmds.RegisterHong,
                    GameNumber = 1,
                    MinimumPressure = 10
                });
            }
            else if (button == PanelButtons.HongWin) // Temporary code
            {
                receiver.RegisterDevice(new RegistrationSettings()
                {
                    TouchSensorMode = contactSensorRequired ? TouchSensorStatusEnum.Required : TouchSensorStatusEnum.NotRequired,
                    OpCode = OpCodeCmds.RegisterTarget,
                    GameNumber = 1,
                    MinimumPressure = 10
                });
            }
        }