Fix: clear dgvBluetoothDevices.
This commit is contained in:
@@ -2,12 +2,10 @@
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using InTheHand.Net.Bluetooth;
|
||||
using InTheHand.Net.Sockets;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using System.Drawing.Printing;
|
||||
using Newtonsoft.Json;
|
||||
using System.Drawing;
|
||||
|
||||
@@ -29,6 +27,11 @@ namespace BITable
|
||||
|
||||
private void ScanBluetoothDevices()
|
||||
{
|
||||
dgvBluetoothDevices.Invoke(new Action(() =>
|
||||
{
|
||||
dgvBluetoothDevices.Rows.Clear();
|
||||
}));
|
||||
|
||||
devices = client.DiscoverDevices();
|
||||
foreach (var device in devices)
|
||||
{
|
||||
@@ -44,8 +47,18 @@ namespace BITable
|
||||
{
|
||||
Task.Factory.StartNew(new Action(() =>
|
||||
{
|
||||
btnScanBluetoothDevices.Invoke(new Action(() =>
|
||||
{
|
||||
btnScanBluetoothDevices.Enabled = false;
|
||||
}));
|
||||
ScanBluetoothDevices();
|
||||
}));
|
||||
})).ContinueWith(t =>
|
||||
{
|
||||
btnScanBluetoothDevices.Invoke(new Action(() =>
|
||||
{
|
||||
btnScanBluetoothDevices.Enabled = true;
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
private void dgvBluetoothDevices_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user