public IList <StartupNotificationGroup> GetPathToScenario(StartupNotification scenario) { IList <StartupNotificationGroup> answer = new List <StartupNotificationGroup>() { this }; GetPathToScenarioHelper(scenario, answer); return(answer); }
private void GetPathToScenarioHelper(StartupNotification scenario, IList <StartupNotificationGroup> listToAppendTo) { foreach (var child in Children.OfType <StartupNotification>()) { if (child == scenario) { return; } } foreach (var groupChild in Children.OfType <StartupNotificationGroup>()) { if (groupChild.Contains(scenario.UIElementType)) { listToAppendTo.Add(groupChild); groupChild.GetPathToScenarioHelper(scenario, listToAppendTo); } } }