public void Start() { AttachEvents(); var lastDevice = DeviceStorage.LoadLastDevice(); if (lastDevice != null) { UseLastDevice(lastDevice); } }
/// <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); }