X hits on this document

261 views

0 shares

0 downloads

0 comments

99 / 102

["playerScore"].ToString());

computer.Score = int.Parse(Microsoft.Phone.Shell.PhoneApplicationService.Current.State["computerScore"].ToString());

isHumanTurn = !bool.Parse(Microsoft.Phone.Shell.PhoneApplicationService.Current.State["isHumanTurn"].ToString());

       wind = Vector2.Zero;

       changeTurn = true;

       computer.Catapult.CurrentState = CatapultState.Reset;

   }

   else

       // Start the game

       Start();

}

Note the highlighted statements at the end of the function. Those statements utilize the Tombstoning capabilities to reload the application state, where the first highlighted statement checks if any state data is available.

This concludes the task.

Now our game is enriched with tombstoning and state reloading features.

Task 2 – Utilize Chooser and Launcher to run another application from the game

As we already mentioned, we use Choosers and Launchers to launch another application from our game. The difference between Choosers and Launchers is that Choosers provide results back to the game, while Launchers do not. The development platform provides a rich collection of Choosers and Launchers that launch standard Windows Phone tasks out-of-the box. In this exercise, we will use a Chooser of type PhoneNumberChooserTask and a Launcher of type SmsComposeTask.

PhoneNumberChooserTask launches the standard Phone Book application and returns the selected number back to the game.

SmsComposeTask sends SMS to the given number.

In this task, we will integrate two those capabilities into our game.

1.

Open file MainMenuScreen.cs located in “Screens” folder.

2.

Locate the “Using Statements” region and add there the following statement:

C#

using Microsoft.Phone.Tasks;

This statement allows using Choosers and Launchers.

Page | 99

Document info
Document views261
Page views261
Page last viewedWed Dec 07 22:40:21 UTC 2016
Pages102
Paragraphs3115
Words17333

Comments