示例#1
0
        public void Start()
        {
            AttachEvents();
            var lastDevice = DeviceStorage.LoadLastDevice();

            if (lastDevice != null)
            {
                UseLastDevice(lastDevice);
            }
        }
示例#2
0
        /// <summary>
        /// Allow the user to select a Bluetooth device in a Windows dialog.
        /// </summary>
        /// <returns></returns>
        public static BluetoothDevice SelectDeviceInDialog(IWin32Window window)
        {
            var dlg    = new SelectBluetoothDeviceDialog();
            var result = dlg.ShowDialog(window);

            if (result != DialogResult.OK || dlg.SelectedDevice == null)
            {
                return(null);
            }

            var bluetoothDevice = new BluetoothDevice(dlg.SelectedDevice.DeviceAddress);

            DeviceStorage.SaveLastDevice(bluetoothDevice);
            return(bluetoothDevice);
        }