X hits on this document

242 views

0 shares

0 downloads

0 comments

94 / 102

if (System.Windows.MessageBox.Show("Old game available.\nDo you want to continue last game?", "Load Game", System.Windows.MessageBoxButton.OKCancel) == System.Windows.MessageBoxResult.OK)

               isLoaded |= true;

           else

               isLoaded = false;

       }

   }

   if (isLoaded)

   {

       PhoneApplicationService.Current.State.Add("IsReload", true);

       PhoneApplicationService.Current.State.Add("playerScore", playerScore);

       PhoneApplicationService.Current.State.Add("computerScore", computerScore);

       PhoneApplicationService.Current.State.Add("isHumanTurn", isHumanTurn);

       GameplayScreen gameplayScreen = new GameplayScreen();

       mainMenuScreen.ScreenManager.AddScreen(gameplayScreen, null);

   }

}

private bool LoadFromIsolatedStorage(ref int playerScore, ref int computerScore, ref bool isHumanTurn)

{

   bool res = true; // Assume success

   // Load from Isolated Storage file

   using (IsolatedStorageFile isolatedStorageFile

       = IsolatedStorageFile.GetUserStoreForApplication())

   {

       if (isolatedStorageFile.FileExists(fileName))

       {

           //If user choose to save, create a new file

           using (IsolatedStorageFileStream fileStream

= isolatedStorageFile.OpenFile(fileName, FileMode.Open))

           {

using (StreamReader streamReader = new StreamReader(fileStream))

               {

                   playerScore = int.Parse(streamReader.ReadLine(),

System.Globalization.NumberStyles.Integer);

Page | 94

Document info
Document views242
Page views242
Page last viewedTue Dec 06 10:25:13 UTC 2016
Pages102
Paragraphs3115
Words17333

Comments