Switching Screens |
The following code snippets can be used/modified to change the current screen.
Switch to a specific screen.
// get reference to screen control assuming there is // a screen named "Screen2" in the current application string screenName = "Screen2"; ControlScreen nextScreen = Application.Screens[screenName] as ControlScreen; // switch screens Application.CurrentScreen = nextScreen;
Switch to the next screen.
// get reference to the next screen in the application int currentScreenIndex = Application.Screens.IndexOf(application.CurrentScreen); int nextScreenIndex = currentScreenIndex + 1; if (nextScreenIndex >= Application.Screens.Count()) nextScreenIndex = 0; ControlScreen nextScreen = Application.Screens[nextScreenIndex] as ControlScreen; // switch screens Application.CurrentScreen = nextScreen;