public BluetoothConnection(DeviceViewAdapter adapter)
 {
     this.adapter = adapter;
     _adapter     = CrossBleAdapter.Current;
     if (_adapter.IsScanning == true)
     {
         _adapter.StopScan();
     }
     _adapter.ScanForUniqueDevices().Subscribe(device => DeviceDiscovered(device));
 }
Beispiel #2
0
        private void TurnOnSerchingConnection(object sender, EventArgs e)
        {
            if (!CheckPermission())
            {
                return;
            }

            adapter       = new DeviceViewAdapter();
            layoutManager = new LinearLayoutManager(this);

            recyclerView.SetLayoutManager(layoutManager);
            recyclerView.SetAdapter(adapter);
            adapter.DeviceSelected += OnSelectDevice;

            ((MaterialButton)sender).Visibility = ViewStates.Gone;
            ((MaterialButton)sender).Click     -= TurnOnSerchingConnection;
            ((MaterialButton)sender).Dispose();
        }