O'Reilly logo

Mastering Xamarin UI Development - Second Edition by Steven F. Daniel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Implementing the StartNewGame Instance method

In this section, we will look at implementing the startNewGame instance method in our ViewController class. The startNewGame instance method will be responsible for starting a new game whenever the ViewDidAppear method is fired or the user taps on the Reset Game button.

Let's start by modifying the ViewController class for our SlidingTiles app by performing the following steps:

  1. Ensure that the ViewController.cs file is currently displayed in the code editor.
  2. Next, underneath the ShuffleBoardTiles_Clicked event method, we need to create an event method called startNewGame that will be called whenever a new game is required; enter the following code snippet:
 #region 6 - Instance method to end ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required