private void stomatognathicRow_Load(object sender, EventArgs e) { Type t = _stomatognathic.GetType(); PropertyInfo[] props = t.GetProperties(); var paramR = props.FirstOrDefault(p => p.Name == $"{_param}R" || p.Name == $"{_param}r"); var paramL = props.FirstOrDefault(p => p.Name == $"{_param}L" || p.Name == $"{_param}l"); var valR = paramR.GetValue(_stomatognathic) == null ? 0 : (int)paramR.GetValue(_stomatognathic); var valL = paramL.GetValue(_stomatognathic) == null ? 0 : (int)paramL.GetValue(_stomatognathic); if (valR == 1) { comboBox1.SelectedItem = comboBox1.Items[1]; } else if (valR == 2) { comboBox1.SelectedItem = comboBox1.Items[2]; } else { comboBox1.SelectedItem = comboBox1.Items[0]; } if (valL == 1) { comboBox2.SelectedItem = comboBox2.Items[1]; } else if (valL == 2) { comboBox2.SelectedItem = comboBox2.Items[2]; } else { comboBox2.SelectedItem = comboBox2.Items[0]; } }
private void stomatognathicRow_Load(object sender, EventArgs e) { Type t = _stomatognathic.GetType(); PropertyInfo[] props = t.GetProperties(); var paramR = props.FirstOrDefault(p => p.Name == $"{_param}R" || p.Name == $"{_param}r"); var paramL = props.FirstOrDefault(p => p.Name == $"{_param}L" || p.Name == $"{_param}l"); var valR = paramR.GetValue(_stomatognathic) == null ? 0 : (int)paramR.GetValue(_stomatognathic); var valL = paramL.GetValue(_stomatognathic) == null ? 0 : (int)paramL.GetValue(_stomatognathic); if (valR == 1) { radioButtonR1.Checked = true; } else if (valR == 2) { radioButtonR2.Checked = true; } else if (valR == 3) { radioButtonR3.Checked = true; } if (valL == 1) { radioButtonL1.Checked = true; } else if (valL == 2) { radioButtonL2.Checked = true; } else if (valL == 3) { radioButtonL3.Checked = true; } }