private void toggleFlight(object sender, EventArgs e) { ApplicationBarIconButton btn = (ApplicationBarIconButton)ApplicationBar.Buttons[0]; if (loop.isRunning) { // Then we want to stop it loop.stop(); btn.Text = "Start Flight"; btn.IconUri = new Uri("/Images/appbar.transport.play.rest.png", UriKind.Relative); } else { // Then we want to start it loop.start(camera, map); btn.Text = "Stop Flight"; btn.IconUri = new Uri("/Images/appbar.stop.rest.png", UriKind.Relative); } }