/// <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!"); } }
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); } }
public override void OnUp(BLEButton sender, DateTimeOffset timestamp) { centerButtonPressed = false; }
public override void OnBoth(BLEButton sender, DateTimeOffset timestamp) { AppCommand.MEDIA_PREVIOUSTRACK.Exec(); AppCommand.MEDIA_PLAY_PAUSE.Exec(); centerButtonPressed = true; }
public override void OnRight(BLEButton sender, DateTimeOffset timestamp) { AppCommand.MEDIA_NEXTTRACK.Exec(); centerButtonPressed = true; }
override public void OnBoth(BLEButton button, DateTimeOffset timestamp) { PerformAction(ClickEnum.Both); }
override public void OnRight(BLEButton button, DateTimeOffset timestamp) { PerformAction(ClickEnum.Right); }