private async void SetListBox()
        {
            devinfo = await Task.Run <InTheHand.Net.Sockets.BluetoothDeviceInfo[]>(() => Bluetooth.GetBluetoothDeviceInfo());

            ((ListBox)this.checkedListBox1).DataSource    = devinfo;
            ((ListBox)this.checkedListBox1).DisplayMember = "DeviceAddress";
            ((ListBox)this.checkedListBox1).ValueMember   = "DeviceAddress";
            this.button1.Text    = "Find Bluetooth Devices";
            this.button1.Enabled = true;
        }
예제 #2
0
        private async void SetListBox()
        {
            devinfo = await Task.Run <InTheHand.Net.Sockets.BluetoothDeviceInfo[]>(() => Bluetooth.GetBluetoothDeviceInfo());

            try
            {
                ((ListBox)this.BluethoothDevsCheckedListBox).DataSource    = devinfo;
                ((ListBox)this.BluethoothDevsCheckedListBox).DisplayMember = "DeviceAddress";
                ((ListBox)this.BluethoothDevsCheckedListBox).ValueMember   = "DeviceAddress";
                this.button1.Text    = "Find Bluetooth Devices";
                this.button1.Enabled = true;
            }
            catch (Exception e)
            {
                Debug.WriteLine("SetListBox in Form1 threw an exception");
                throw e;
            }
        }