private void ScanDevices_Click(object sender, RoutedEventArgs e) { nearbyDevicesListBox.Items.Clear(); var tools = nearbyDevicesController.AllTools().Select(x => new ToolViewModel { ID = x.Key, BluetoothAddress = ToolController.ByteArrayToString(x.Value.BluetoothAddress), MPBID = x.Value.MPBID, Name = x.Value.Name, RSSI = x.Value.RSSI }).OrderByDescending(x => x.RSSI); nearbyDevicesListBox.ItemsSource = tools; }
static void Main(string[] args) { SortedDictionary <int, Tool> allTools; using (var tc = new ToolController()) { System.Threading.Thread.Sleep(1000); allTools = tc.AllTools(); foreach (var tool in allTools) { if (tool.Value.MPBID == "0007005DF1") //Joe drill //if (tool.Value.MPBID == "0007000D36") //Chris drill { tc.SendCommand(tool.Value.ID); } } Console.WriteLine("Press the any key to exit"); Console.Read(); } }