public override void Action() { WinFormComboBox cb = (WinFormComboBox)control; ListItem listItem = cb.Items.Where( item => item.NameMatches(criteria) || item.Name.Replace(" ", "").Contains(criteria) || item.Name.Replace(" ", "") == criteria ).FirstOrDefault(); if (actionType == ActionType.click) { listItem.Click(); return; } if (actionType == ActionType.doubleClick) { listItem.DoubleClick(); return; } if (actionType == ActionType.select) { listItem.Select(); return; } throw new Exception($"Control Doesn't Accept Action Type {actionType}"); }
public Boolean UpdateComboBox(WinFormComboBox box, int index) { if (box.Enabled) { box.Click(); ListItems items = box.Items; try { box.Select(index); } catch { box.Select(items.Count - 1); return(false); } return(true); } else { return(false); } }