void CreateNewGameWindow()
 {
     switch (activeWindow)
     {
         case "NewGame":
             newGameWindow = new NewGameWindow(this);
             newGameWindow.Load(Content);
             break;
         case "Loading":
             loadingWindow = new LoadingWindow(this);
             loadingWindow.Load(Content);
             break;
         case "Game":
             gameWindow = new GalacticEmpire.GameWindow(this);
             gameWindow.Load(this);
             break;
         case "ContinueGame":
             if(File.Exists("LastSave"))
             {
                 StreamReader sr = new StreamReader("LastSave");
                 string path = sr.ReadLine();
                 if(File.Exists(path))
                 {
                     loadingWindow = new LoadingWindow(this, path);
                     loadingWindow.Load(Content);
                     activeWindow = "Loading";
                 }
                 sr.Close();
             }
             break;
         case "Credits":
             creditsWindow = new CreditsWindow(this);
             creditsWindow.Load(this);
             break;
         case "Settings":
             settingsWindow = new SettingsWindow(this);
             settingsWindow.Load(Content);
             break;
         case "LoadGame":
             loadGameWindow = new LoadGameWindow(this);
             loadGameWindow.Load(Content);
             break;
     }
 }
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
                ExitGame();

            keyPressedTime++;
            //Cambia canzone se il player è stoppato o se si preme tab, ma solo se non si è nella splash screen e la musica è abilitata
            if ((MediaPlayer.State == MediaState.Stopped || Keyboard.GetState().IsKeyDown(Keys.Tab) && keyPressedTime > 10)
                && activeWindow != "SplashScreen" && GameParams.musicEnabled == true)
            {
                if (++songIndex == tracks.Count)
                    songIndex = 0;
                MediaPlayer.Play(tracks[songIndex]);
                keyPressedTime = 0;
            }
            if (GameParams.musicEnabled == false)
                MediaPlayer.Pause();
            else if (MediaPlayer.State == MediaState.Paused && GameParams.musicEnabled)
                MediaPlayer.Play(tracks[songIndex]);

            switch (activeWindow)
            {
                case "SplashScreen":
                    splashScreenWindow.Update(gameTime);
                    if (splashScreenWindow.PresentationFinished)
                    {
                        GameParams.musicEnabled = true;
                        MediaPlayer.Play(tracks[songIndex]);
                        activeWindow = "MainMenu";
                    }
                    break;
                case "MainMenu":
                    mainMenu.Update(gameTime);
                    activeWindow = mainMenu.GetNextWindow();
                    if (activeWindow == "ExitButton")
                        ExitGame();
                    CreateNewGameWindow();

                    break;

                case "NewGame":
                    newGameWindow.Update(gameTime);
                    if (newGameWindow.StartLoading)
                    {
                        activeWindow = "Loading";
                        CreateNewGameWindow();
                    }
                    else if(newGameWindow.BackToMenu)
                    {
                        activeWindow = "MainMenu";
                        CreateNewGameWindow();
                    }
                    break;

                case "Loading":
                    loadingWindow.Update(gameTime);
                    if (!loadingWindow.IsLoading)
                    {
                        activeWindow = "Game";
                        CreateNewGameWindow();
                    }
                    break;
                case "Game":
                    gameWindow.Update(gameTime);
                    if (GalacticEmpire.GameWindow.ActualState == GalacticEmpire.GameWindow.GameState.FINISHED)
                        activeWindow = "MainMenu";
                    break;
                case "Credits":
                    creditsWindow.Update(gameTime);
                    if (creditsWindow.BackPressed)
                        activeWindow = "MainMenu";
                    break;
                case "Settings":
                    settingsWindow.Update(gameTime);
                    if (settingsWindow.Finished)
                        activeWindow = "MainMenu";
                    break;
                case "LoadGame":
                    loadGameWindow.Update(gameTime);
                    if (loadGameWindow.BackToMenu)
                        activeWindow = "MainMenu";
                    else if (loadGameWindow.StartLoading)
                    {
                        loadingWindow = new LoadingWindow(this, loadGameWindow.FilePath);
                        loadingWindow.Load(Content);
                        activeWindow = "Loading";
                    }
                    break;

                default:
                    activeWindow = "MainMenu";
                    break;

            }

            base.Update(gameTime);
        }