public WindowItemBase FindWindow(string title, string text, string excludeTitle, string excludeText) { WindowItemBase foundWindow = null; if (string.IsNullOrEmpty(title) && string.IsNullOrEmpty(text) && string.IsNullOrEmpty(excludeTitle) && string.IsNullOrEmpty(excludeText)) { foundWindow = LastFound; } else { var criteria = SearchCriteria.FromString(title, text, excludeTitle, excludeText); foundWindow = FindWindow(criteria); } return(foundWindow); }