private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { if (listBox1.SelectedIndex > -1) { BluetootDevice db = (BluetootDevice)listBox1.Items[listBox1.SelectedIndex]; textBox4.Text = db.address.ToString("X"); } }
public void deviceFound(UInt64 deviceAddress, string deviceName, IntPtr param) { if (deviceAddress != 0) { BluetootDevice bd = new BluetootDevice(); bd.address = deviceAddress; bd.name = deviceName.ToString(); listBox1.Invoke((MethodInvoker) delegate() { listBox1.Items.Add(bd); }); } else { progressBar1.Invoke((MethodInvoker) delegate() { progressBar1.Style = ProgressBarStyle.Blocks; }); } }
public void deviceFound(UInt64 deviceAddress, string deviceName, IntPtr param) { if (deviceAddress != 0) { BluetootDevice bd = new BluetootDevice(); bd.address = deviceAddress; bd.name = deviceName.ToString(); listBox1.Invoke((MethodInvoker)delegate() { listBox1.Items.Add(bd); }); } else { progressBar1.Invoke((MethodInvoker)delegate() { progressBar1.Style = ProgressBarStyle.Blocks; }); } }