Esempio n. 1
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);
            }
        }
Esempio n. 2
0
        private async Task PopulateBleComboBox()
        {

            BLEButtonFactory factory = new BLEButtonFactory();
            List<BLEButton> buttonList = factory.GetAllButtons();
            try
            {
                int i = 1;
                foreach (BLEButton b in buttonList)
                {
                    Configuration config = new Configuration();
                    b.Listener = config;
                    string bleName = "BLE " + Convert.ToString(i);
                    bleChoices.Add(bleName, b);
                    i += 1;
                }
            }
            catch
            {
                Console.WriteLine("Found no buttons...");
            }

        }