private async Task updateDevicesGridView() { var devicesProcessor = new DevicesProcessor(activeIoTHubConnectionString, MAX_COUNT_OF_DEVICES, protocolGatewayHost.Text); var devicesList = await devicesProcessor.GetDevices(); devicesList.Sort(); var sortableDevicesBindingList = new SortableBindingList <DeviceEntity>(devicesList); string deviceCurrentlySelected = null; // Save the device ID currently selected on the grid. if (devicesGridView.SelectedRows.Count == 1) { deviceCurrentlySelected = (string)devicesGridView.SelectedRows[0].Cells[0].Value; } devicesGridView.DataSource = sortableDevicesBindingList; devicesGridView.ReadOnly = true; devicesGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; if (devicesList.Count() > MAX_COUNT_OF_DEVICES) { deviceCountLabel.Text = MAX_COUNT_OF_DEVICES + "+"; } else { deviceCountLabel.Text = devicesList.Count().ToString(); } // Re-select the device ID previously selected before the update. // This avoids the super-annoying need to scroll down every time the management grid gets updated. if (deviceCurrentlySelected != null) { findAndSelectRowByDeviceID(deviceCurrentlySelected, true); } }
private async void updateDevicesGridView() { var devicesProcessor = new DevicesProcessor(activeIoTHubConnectionString, MAX_COUNT_OF_DEVICES, protocolGatewayHost.Text); var devicesList = await devicesProcessor.GetDevices(); devicesList.Sort(); devicesGridView.DataSource = devicesList; devicesGridView.ReadOnly = true; devicesGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; }
private async Task updateDevicesGridView() { var devicesProcessor = new DevicesProcessor(activeIoTHubConnectionString, MAX_COUNT_OF_DEVICES, protocolGatewayHost.Text); var devicesList = await devicesProcessor.GetDevices(); devicesList.Sort(); devicesGridView.DataSource = devicesList; devicesGridView.ReadOnly = true; devicesGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; if (devicesList.Count() > MAX_COUNT_OF_DEVICES) { deviceCountLabel.Text = MAX_COUNT_OF_DEVICES.ToString() + "+"; } else { deviceCountLabel.Text = devicesList.Count().ToString(); } }
private async void updateDevicesGridView() { var devicesProcessor = new DevicesProcessor(activeIoTHubConnectionString, MAX_COUNT_OF_DEVICES, protocolGatewayHost.Text); var devicesList = await devicesProcessor.GetDevices(); devicesList.Sort(); devicesGridView.DataSource = devicesList; devicesGridView.ReadOnly = true; devicesGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; if (devicesList.Count() > MAX_COUNT_OF_DEVICES) { deviceCountLabel.Text = MAX_COUNT_OF_DEVICES.ToString() + "+"; } else { deviceCountLabel.Text = devicesList.Count().ToString(); } }