/// <summary> /// Adds a new screen to the screen manager /// </summary> /// <param name="screen"></param> public void Add(Screen screen) { _screens.Add(screen.Name, screen); _screenPositions.Add(screen.Name); screen.NextScreen = ()=> NextScreen(); }
public void NextScreen() { //TODO: Is there a way of doing this without having to keep a dictionary AND a list? var nextPosition = _screenPositions.IndexOf(this.ActiveScreen.Name) + 1; if (nextPosition > _screenPositions.Count) nextPosition = 0; ActiveScreen = _screens[_screenPositions[nextPosition]]; }