Exemplo n.º 1
0
 void AppendDevices(BluetoothDeviceInfo[] newDevices)
 {
     if (newDevices != null)
     {
         foreach (BluetoothDeviceInfo bdi in newDevices)
         {
             BdiListViewItem lvi = new BdiListViewItem(bdi);
             lvi.ImageIndex = 0;
             lvDevices.Items.Add(lvi);
         }
         //
         if (lvDevices.Items.Count > 0)
         {
             mnuSelect.Enabled = true;
         }
     }
 }
Exemplo n.º 2
0
        private void selectDevice(object sender, System.EventArgs e)
        {
            if (lvDevices.SelectedIndices.Count > 0 && lvDevices.SelectedIndices[0] > -1 && lvDevices.SelectedIndices[0] < lvDevices.Items.Count)
            {
                _closed        = true;
                Cursor.Current = Cursors.Default;
                //
                ListViewItem    item0 = lvDevices.Items[lvDevices.SelectedIndices[0]];
                BdiListViewItem item  = item0 as BdiListViewItem;
                Debug.Assert(item != null, "non BdiListViewItem selected!!");
                if (item != null)
                {
                    selectedDevice = item.Device;

                    if (fForceAuthentication)
                    {
                        //authenticate with the selected device
                    }

                    this.DialogResult = DialogResult.OK;
                }
            }
        }