private async void RefreshDeviceButton_Click(object sender, EventArgs e) { // If the server isn't running and the server start fails, return. if (!_serverRunning && !TryStartServer()) { return; } try { // Get a list of all devices currently connected. var devices = await _client.GetDevicesAsync(); // Pause drawing to the ComboBox while we add items. DeviceComboBox.BeginUpdate(); DeviceComboBox.Items.Clear(); foreach (Device d in devices) { DeviceComboBox.Items.Add(d); } // Resume drawing. DeviceComboBox.EndUpdate(); } catch (AdbException ex) { MessageBox.Show(ex.Message, "ADB Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private async Task <LearningModelSession> CreateLearningModelSession(LearningModel model, int batchSizeOverride = -1) { var deviceKind = DeviceComboBox.GetDeviceKind(); var device = new LearningModelDevice(deviceKind); var options = new LearningModelSessionOptions(); if (batchSizeOverride > 0) { options.BatchSizeOverride = (uint)batchSizeOverride; } var session = new LearningModelSession(model, device, options); return(session); }