private void NextEventChangeHandler(ETypeImpl newType) { HelperUI.ModifyMethod(cmbNextAlg, () => { if (Next != null) { var newValues = newType.HowToCallTheNextOne(Next.TypeImpl); var current = cmbNextAlg.SelectedItem; cmbNextAlg.Items.Clear(); foreach (var aux in newValues) { cmbNextAlg.Items.Add(aux); } if (current != null && cmbNextAlg.Items.Contains(current)) { cmbNextAlg.SelectedItem = current; } if (cmbNextAlg.SelectedItem == null && newValues.Count == 1) { cmbNextAlg.SelectedItem = newValues[0]; } } }); }
private void EventNextHandler(ETypeImpl newType) { HelperUI.ModifyMethod(cmbNextAlg, () => { if (Next != null) { /*cmbNextAlg*/ var newValues = newType.HowToCallTheNextOne(next.TypeImpl); var current = cmbNextAlg.SelectedItem; cmbNextAlg.Items.Clear(); foreach (var aux in newValues) { cmbNextAlg.Items.Add(aux); } if (current != null && cmbNextAlg.Items.Contains(current)) { cmbNextAlg.SelectedItem = current; } if (cmbNextAlg.SelectedItem == null && newValues.Count == 1) { cmbNextAlg.SelectedItem = newValues[0]; } } }); HelperUI.ModifyMethod(cmbMyImpl, () => { /*cmbImpl*/ var newValuesToBeImplemented = newType.DoMyWork(); var currentImplementation = cmbMyImpl.SelectedItem; cmbMyImpl.Items.Clear(); foreach (var aux in newValuesToBeImplemented) { cmbMyImpl.Items.Add(aux); } if (currentImplementation != null && cmbMyImpl.Items.Contains(currentImplementation)) { cmbMyImpl.SelectedItem = currentImplementation; } if (cmbMyImpl.SelectedItem == null && newValuesToBeImplemented.Count == 1) { cmbMyImpl.SelectedItem = newValuesToBeImplemented[0]; } }); }