示例#1
0
        private void ScanClicked(object sender, EventArgs e)
        {
            BluetoothConnectionState = "Searching...";

            scan = new Scan();

            scan.OnDeviceFound += (BluetoothDevice device) =>
            {
                BluetoothConnectionState = string.Format("Found {0} devices", scan.Devices().Count);
            };
            scan.OnStateChanged += (string msg) =>
            {
                BluetoothConnectionState = msg;
            };

            try
            {
                scan.Start();
            }
            catch (InvalidOperationException ex)
            {
                BluetoothConnectionState = ex.Message;
            }
        }