private void comboBoxValues_SelectedIndexChanged(object sender, EventArgs e) { if (!_isUpdating) { PortableEnum.EnumEntry ent = comboBoxValues.SelectedItem as PortableEnum.EnumEntry; if (ent != null) { if (_node.Value != ent.Value) { _node.Value = ent.Value; } } } }
private void SetupFrame() { _isUpdating = true; comboBoxValues.Items.Clear(); if (_node != null) { PortableEnum.EnumEntry selected = null; foreach (PortableEnum.EnumEntry ent in _node.Value.Entries) { if (ent.Value == _node.Value.Value) { selected = ent; } comboBoxValues.Items.Add(ent); } if (selected != null) { comboBoxValues.SelectedItem = selected; } else { comboBoxValues.Text = _node.Value.ToString(); } } else { comboBoxValues.Text = String.Empty; } comboBoxValues.Enabled = !_readOnly; _isUpdating = false; }