public BugSweeperPage() { InitializeComponent(); board.GameStarted += (sender, args) => { isGameInProgress = true; gameStartTime = DateTime.Now; Xamarin.Insights.Track("GameStarted"); handle = Xamarin.Insights.TrackTime("GameLength"); handle.Start(); Device.StartTimer(TimeSpan.FromSeconds(1), () => { timeLabel.Text = (DateTime.Now - gameStartTime).ToString(timeFormat); return(isGameInProgress); }); }; board.GameEnded += (sender, hasWon) => { isGameInProgress = false; handle.Stop(); if (hasWon) { DisplayWonAnimation(); Xamarin.Insights.Track("Won"); } else { DisplayLostAnimation(); Xamarin.Insights.Track("Lost"); } }; PrepareForNewGame(); }
public BugSweeperPage() { InitializeComponent(); board.GameStarted += (sender, args) => { isGameInProgress = true; gameStartTime = DateTime.Now; Xamarin.Insights.Track("GameStarted"); handle = Xamarin.Insights.TrackTime("GameLength"); handle.Start(); Device.StartTimer(TimeSpan.FromSeconds(1), () => { timeLabel.Text = (DateTime.Now - gameStartTime).ToString(timeFormat); return isGameInProgress; }); }; board.GameEnded += (sender, hasWon) => { isGameInProgress = false; handle.Stop(); if (hasWon) { DisplayWonAnimation(); Xamarin.Insights.Track("Won"); } else { DisplayLostAnimation(); Xamarin.Insights.Track("Lost"); } }; PrepareForNewGame(); }
public void Start() { _handle.Start(); }