/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FormEditAction_Load(object sender, EventArgs e) { // Populate registered object types IEnumerable <Type> types = Reflection.GetConcreteClassesDerivedFrom <T>(); foreach (Type type in types) { ItemObjectType item = new ItemObjectType(type); iComboBoxObjectType.Items.Add(item); } if (Object == null) { // Creating new issue, select our first item iComboBoxObjectType.SelectedIndex = 0; } else { // Editing existing object // Look up our item in our object type combobox foreach (ItemObjectType item in iComboBoxObjectType.Items) { if (item.Type == Object.GetType()) { iComboBoxObjectType.SelectedItem = item; } } } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FormEditObject_Load(object sender, EventArgs e) { // Disable trigger until we are done editing Properties.Settings.Default.EarManager.CurrentState = SharpLib.Ear.Object.State.Edit; // Populate registered object types IEnumerable <Type> types = Reflection.GetConcreteClassesDerivedFrom <T>(); foreach (Type type in types) { ItemObjectType item = new ItemObjectType(type); if (item.Hidden()) { continue; } iComboBoxObjectType.Items.Add(item); } if (Object == null) { // Creating new issue, select our first item iComboBoxObjectType.SelectedIndex = 0; } else { // Editing existing object // Look up our item in our object type combobox foreach (ItemObjectType item in iComboBoxObjectType.Items) { if (item.Type == Object.GetType() // TODO: Remove that at some point, we just used it to transition from EventHid to EventHidKey || (item.Type == typeof(EventHidKey) && Object.GetType() == typeof(EventHid))) { iComboBoxObjectType.SelectedItem = item; } } } }