public static void FadeOut() { /** * todo Possible hack * This code assumes that the base content control can't be changed if * there is a popup window above. In cases of moving to a game screen, * the popup window has to completely get rid of all previous popup * windows before changing the base control. Because of that, the popup * window stack is cleared whenever the base content is changed. When a * popup window */ if (popupControls.Count == 0) { //todo does removing this line break other code? // The current control is the base one //FadeOutControl(baseContentControl); // Do we need to set the menu back up? if (mainMenuUserControl == null) { return; } baseContentControl.Content = mainMenuUserControl; FadeInControl(baseContentControl, 2); mainMenuUserControl = null; } else { // Remove the top UserControl popupControls.Pop(); FadeOutControl(popupContentControl); // Don't fade in the next control if we don't have one if (popupControls.Count == 0) { return; } // Get the previous one on the stack popupContentControl.Content = popupControls.Peek(); FadeInControl(popupContentControl, 7); } }
public static void setBaseContentControl(UserControl control) { // Kill the popups if any are in the way if (popupControls.Count != 0) { popupControls.Clear(); FadeOutControl(popupContentControl); } HomeScreenUserControl homeScreen = baseContentControl.Content as HomeScreenUserControl; if (homeScreen != null) { mainMenuUserControl = homeScreen; } baseContentControl.Content = control; FadeInControl(baseContentControl, 2); }