private void RefreshRegistrations(object sender, EventArgs e) { if (acListComboBox.SelectedIndex >= 0) { var ac = aircrafts.FindAircraft(acListComboBox.Text); regComboBox.SetItemsPreserveSelection(ac .Where(c => TakeoffProfileExists(c.Config.TOProfile)) .Select(c => c.Config.Registration) .ToArray()); } }
public void FindAircraftTest() { var manager = new AcConfigManager(); manager.Add(config1); manager.Add(config2); var result = manager.FindAircraft(config1.Config.AC).ToList(); Assert.AreEqual(2, result.Count); Assert.IsTrue(result.Contains(config1)); Assert.IsTrue(result.Contains(config2)); }
private void RefreshRegistrations(object sender, EventArgs e) { if (acListComboBox.SelectedIndex >= 0) { var ac = aircrafts.FindAircraft(acListComboBox.Text); var items = regComboBox.Items; items.Clear(); items.AddRange(ac .Where(c => TakeoffProfileExists(c.Config.TOProfile)) .Select(c => c.Config.Registration) .ToArray()); if (items.Count > 0) { regComboBox.SelectedIndex = 0; } } }