Example #1
0
        private void DeviceWatcher_Added(DeviceWatcher sender, DeviceInformation args)
        {
            try
            {
                if (sender != mDeviceWatcher)
                {
                    return;
                }
                if (args.Name == string.Empty)
                {
                    return;
                }
                if (mVisibleDevices == null)
                {
                    return;
                }

                var temp = new UnPairedDeviceBLE(args);
                MutexBlock(() =>
                {
                    Debug.WriteLine(args.Name);
                    AddUniqueItem(temp);
                }, ((index++).ToString() + " Adding"));
            }
            catch { Debug.WriteLine("Caught Error : private void DeviceWatcher_Added(DeviceWatcher sender, DeviceInformation args)"); }
        }
Example #2
0
        private void ConnectionComplete(UnPairedDeviceBLE input)
        {
            BluetoothLEDevice.FromIdAsync(input.Information.Id).AsTask().ContinueWith(
                (obj) =>
            {
                Debug.WriteLine("Connection Complete.");
                if (obj.Result == null)
                {
                    return;
                }

                var temp = new PairedDeviceBLE(obj.Result, (dev) =>
                {
                    Debug.WriteLine("Enumeration Complete.");
                    TriggerDeviceConnected(dev);
                });
            });
        }