Пример #1
0
 /// <summary>
 /// Shows a pop-up if a BLE button is around and reachable.
 /// </summary>
 private async void testConnectivity(BLEButton bleButton)
 {
     if (await bleButton.Connect())
     {
         MessageBox.Show("BLE button detected and ready to use!");
     }
 }
Пример #2
0
        const int HOLD_INTERVAL = 250; //In ms

        public MainWindow()
        {
            InitializeComponent();
            holdTimer.Interval  = HOLD_INTERVAL;
            holdTimer.AutoReset = false;
            holdTimer.Elapsed  += centerButton_Hold;

            BLEButtonFactory factory = new BLEButtonFactory();
            List <BLEButton> buttons = factory.GetAllButtons();

            if (buttons.Count > 0)
            {
                BLEButton bleButton = factory.GetAllButtons()[0];
                bleButton.Listener = new BLEListener(centerButton);
                testConnectivity(bleButton);
            }
        }
Пример #3
0
 public override void OnUp(BLEButton sender, DateTimeOffset timestamp)
 {
     centerButtonPressed = false;
 }
Пример #4
0
 public override void OnBoth(BLEButton sender, DateTimeOffset timestamp)
 {
     AppCommand.MEDIA_PREVIOUSTRACK.Exec();
     AppCommand.MEDIA_PLAY_PAUSE.Exec();
     centerButtonPressed = true;
 }
Пример #5
0
 public override void OnRight(BLEButton sender, DateTimeOffset timestamp)
 {
     AppCommand.MEDIA_NEXTTRACK.Exec();
     centerButtonPressed = true;
 }
Пример #6
0
 override public void OnBoth(BLEButton button, DateTimeOffset timestamp)
 {
     PerformAction(ClickEnum.Both);
 }
Пример #7
0
 override public void OnRight(BLEButton button, DateTimeOffset timestamp)
 {
     PerformAction(ClickEnum.Right);
 }