Fix: clear dgvBluetoothDevices.

This commit is contained in:
2020-06-20 17:25:41 +07:00
parent eac82673c8
commit 3896d05526
31 changed files with 94126 additions and 4317 deletions

View File

@@ -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)