示例#1
0
 private void OnReadyPacket(object sender, ReceivedComPacketEventArgs e)
 {
     _timeoutTimer.Stop();
     CanSendCommand = true;
     var handler = DeviceReady;
     if (handler != null)
         handler();
 }
示例#2
0
        private void OnButtonStatePacket(object sender, ReceivedComPacketEventArgs e)
        {
            var handler = ButtonStateChanged;
            var packet = (ButtonStatePacket)e.Packet;
            switch(packet.Id)
            {
                case ButtonId.Back:
                    BackButtonPressed = packet.IsPressed;
                    break;

                case ButtonId.Fwd:
                    FwdButtonPressed = packet.IsPressed;
                    break;

                case ButtonId.Left:
                    LeftButtonPressed = packet.IsPressed;
                    break;

                case ButtonId.Right:
                    RightButtonPressed = packet.IsPressed;
                    break;

                case ButtonId.Up:
                    UpButtonPressed = packet.IsPressed;
                    break;

                case ButtonId.Down:
                    DownButtonPressed = packet.IsPressed;
                    break;
            }

            if (handler != null)
                handler(packet.Id, packet.IsPressed);
        }
示例#3
0
        private void OnAccelerometerValuesPacket(object sender, ReceivedComPacketEventArgs e)
        {
            var packet = (AccelerometerValuesPacket)e.Packet;

            AccelerometerX = packet.X;
            AccelerometerY = packet.Y;
            AccelerometerZ = packet.Z;

            var handler = AccelerometerValuesReceived;
            if (handler != null)
                handler(packet.X, packet.Y, packet.Z);
        }
示例#4
0
        private void OnBrightnessPacket(object sender, ReceivedComPacketEventArgs e)
        {
            var packet = (BrightnessPacket)e.Packet;
            _brightness = packet.Brightness;
            OnPropertyChanged("Brightness");

            var handler = BrightnessReceived;
            if (handler != null)
                handler(_brightness);
        }
示例#5
0
        private void OnAccelerometerStatePacket(object sender, ReceivedComPacketEventArgs e)
        {
            var packet = (AccelerometerStatePacket)e.Packet;
            _isAccelerometerOn = packet.IsAccelerometerOn;
            OnPropertyChanged("IsAccelerometerOn");

            var handler = AccelerometerStateReceived;
            if (handler != null)
                handler(_isAccelerometerOn);
        }