private async void msg() { insertData objH = new insertData(); bool isAdded; var messgeDialog = new MessageDialog("Are you sure you want to exit this game?"); messgeDialog.Commands.Add(new UICommand("Yes")); messgeDialog.Commands.Add(new UICommand("No")); messgeDialog.DefaultCommandIndex = 0; messgeDialog.CancelCommandIndex = 1; var result = await messgeDialog.ShowAsync(); if (result.Label.Equals("Yes")) { isAdded = await objH.insertHighScore(nam, TotalPoints); this.Frame.Navigate(typeof(GamePage)); } }
private async void mytimer_Tick(object sender, object e) { bool isAdded; insertData objH = new insertData(); lblSecond.Text = seconds--.ToString(); lblMinutes.Text = minutes.ToString(); if (lblSecond.Text.Trim() == "0") { mytimer.Stop(); if(numPlay == 5 ){ elpNum1.Fill = new SolidColorBrush(Colors.Red); numPlay--;} else if (numPlay == 4) { elpNum2.Fill = new SolidColorBrush(Colors.Red); numPlay--; } else if (numPlay == 3) { elpNum3.Fill = new SolidColorBrush(Colors.Red); numPlay--; } else if (numPlay == 2) { elpNum4.Fill = new SolidColorBrush(Colors.Red); numPlay--; } else if (numPlay == 1) { elpNum5.Fill = new SolidColorBrush(Colors.Red); numPlay--; } else { btnStart.IsEnabled = false; isAdded = await objH.insertHighScore(nam, TotalPoints); messageBox("Game over try again"); //mytimer.Stop(); } seconds = 25; } if (seconds % 10 == 0) { minutes--; lblMinutes.Text = minutes.ToString(); } }
private async void mytimer_Tick(object sender, object e) { lblSecond.Text = seconds--.ToString(); insertData objH = new insertData(); bool isAdded; if (lblSecond.Text.Trim() == "0") { mytimer.Stop(); if (numPlay == 4) { elpNum1.Fill = new SolidColorBrush(Colors.Red); numPlay--; } else if (numPlay == 3) { elpNum2.Fill = new SolidColorBrush(Colors.Red); numPlay--; } else if (numPlay == 2) { elpNum3.Fill = new SolidColorBrush(Colors.Red); numPlay--; } else if (numPlay == 1) { elpNum4.Fill = new SolidColorBrush(Colors.Red); numPlay--; } else if(numPlay == 0) { messageBox("Game over try again"); //mytimer.Stop(); // btnStartGame.IsEnabled = false; isAdded = await objH.insertHighScore(nam, totalPoints); if(isAdded == true) { // messageBox("you have set a new high score reccond"); } } seconds = 5; minutes--; lblMinutes.Text = minutes.ToString(); } }