public void GetQDSSettings(int qds = 0) { DistributionServiceSettings = _apiClient.GetQDSSettings(DistributionServices[qds].ID, QDSSettingsScope.Advanced); var cpuAffinity = DistributionServiceSettings.Advanced.CPUAffinity.Count(); foreach (var checkBox in groupAffinity.Controls.OfType <CheckBox>().OrderBy(box => Convert.ToInt32(box.Name.Remove(0, 8))).Reverse().Take(64 - cpuAffinity).Reverse()) { checkBox.Enabled = false; } var checkBoxList = groupAffinity.Controls.OfType <CheckBox>().OrderBy(box => Convert.ToInt32(box.Name.Remove(0, 8))).Take(cpuAffinity).ToList(); for (int i = 0; i < cpuAffinity; i++) { checkBoxList[i].Checked = DistributionServiceSettings.Advanced.CPUAffinity[i]; } switch (DistributionServiceSettings.Advanced.CPUPriority) { case CPUPriority.High: cpuPriorityHigh.Select(); break; case CPUPriority.Normal: cpuPriorityNormal.Select(); break; case CPUPriority.Low: cpuPriorityLow.Select(); break; } txtMaxQvbAdmin.Text = DistributionServiceSettings.Advanced.MaxQvbAdmin.ToString(); txtMaxQvbDist.Text = DistributionServiceSettings.Advanced.MaxQvbDist.ToString(); btnUpdate.Enabled = false; }