Game Progress Not Being Saved

Feb 7, 2012 at 12:23 AM
Edited Feb 7, 2012 at 12:24 AM

I'm having problems with game progress not being saved.  It seems to be intermittant (I haven't figured out what the situation is that causes this.)  I've tried debugging, but it seems sometimes the OnExiting method is not called when navigating out of the application.  Has anyone else seen this?  Does anyone have any ideas how this could be fixed?  I've received some negative ratings in the marketplace due to this issue and I really would like to resolve this for everyone.

I have not changed any of the code in Initialize or OnExiting.

Developer
Feb 8, 2012 at 10:03 AM

You could try the following:

Inside SampleGame.cs, override OnDeactivated, and then copy the code from OnExiting into OnDeactivated.

protected override void OnDeactivated(object sender, EventArgs args)
        {
            Settings.Save();
            using (var bw = ProfileManager.CurrentProfile.Write(ProgressTracker.ProgressFile))
            {
                ProgressTracker.Save(bw);
            }

            ProfileManager.CurrentProfile.CloseStream();
            HighScores.Save();

            _screens.CloseScreen();

            base.OnDeactivated(sender, args);
        }
Feb 13, 2012 at 2:49 AM

Clint,

Thanks.  This seems to have worked.  You may want to include this in the source code.

 

 

Coordinator
Feb 13, 2012 at 3:18 AM

Wasn't me, Michael for the help win!  :-)

Good idea