// This method is by Urho and controls the game being on the page
        protected override async void OnAppearing()
        {
            base.OnAppearing();

            GameApp game = await surfaceGame.Show <GameApp>(new Urho.ApplicationOptions(assetsFolder: "GameData")
            {
                ResizableWindow = true,
                AdditionalFlags = $"{hardcore.ToString()},{continueGame.ToString()},{charClass.ToString()},{cheat.ToString()}"
            });

            // This method is passed into the game and will be called on restart
            game.Restart = () =>
            {
                Device.BeginInvokeOnMainThread(async() =>
                {
                    await game.Exit();
                    App.Current.MainPage = new MainPage();
                    App.Utilities.SetFullscreen();
                });
                return(false);
            };

            // This method is passed into the game and will be called on win
            game.HandleWin = () =>
            {
                int score = game.PlayerCharacter.Score;

                bool isHighscore = HighScoresManager.CheckScore(score);

                // Exit game
                Device.BeginInvokeOnMainThread(async() =>
                {
                    await game.Exit();
                    App.Current.MainPage = new Win(score, isHighscore);
                    App.Utilities.SetFullscreen();
                });
                return(false);
            };

            // This method is passed into the game and will be called on lose
            game.HandleLose = () =>
            {
                Device.BeginInvokeOnMainThread(async() =>
                {
                    await game.Exit();
                    App.Current.MainPage = new Lose();
                    App.Utilities.SetFullscreen();
                });
                return(false);
            };

            // Load saved game
            if (continueGame)
            {
                game.Load("latest.txt");
            }
        }