Cirrious.MvvmCross.Plugins.Sphero.Droid.Tooth.SpheroFinder.Find C# (CSharp) Method

Find() public method

public Find ( Action onSuccess, Action onError ) : void
onSuccess Action
onError Action
return void
        public void Find(Action<IList<IAvailableSphero>> onSuccess, Action<Exception> onError)
        {
            ThreadPool.QueueUserWorkItem(ignored =>
                {
                    try
                    {
                        // Get the local Bluetooth adapter
                        var adapter = BluetoothAdapter.DefaultAdapter;
                        var devices = adapter.BondedDevices
                                             .Where(p => p.Name.Contains("Sphero"))
                                             .Select(p => new AvailableSphero(p) as IAvailableSphero)
                                             .ToList();
                        onSuccess(devices);
                    }
                    catch (Exception exception)
                    {
                        onError(exception);
                    }
                });
        }
    }
SpheroFinder