private async void EasyButton_Click(object sender, RoutedEventArgs e) { width = outer.ActualWidth; height = outer.ActualHeight; var messageDialog2 = new MessageDialog($"NOTICE! A game of Mine Sweeper costs {Game_Hub.MineSweeperGameCost} Crystals. Are you sure?"); messageDialog2.Commands.Add(new UICommand("Yes") { Id = 0 }); messageDialog2.Commands.Add(new UICommand("No") { Id = 1 }); var result2 = await messageDialog2.ShowAsync(); if ((int)result2.Id == 1) { return; } if (_IBalanceHandler.GetBalance() < Game_Hub.MineSweeperGameCost) { var messageDialog3 = new MessageDialog("ERROR: you don't have enough crystals!"); messageDialog3.Commands.Add(new UICommand("OK") { Id = 0 }); await messageDialog3.ShowAsync(); return; } _IBalanceHandler.SendTransaction(-Game_Hub.MineSweeperGameCost, null); this.Frame.Navigate(typeof(GameMineSweeperEasy)); }
private async void WinButton(object sender, RoutedEventArgs e) { var messageDialog = new MessageDialog("ALL YOUR CATS HAVE BEEN SAVED! Pusica will be so happy to play with them :D. But we can still save some kittens ! What do you want to do?"); messageDialog.Commands.Add(new Windows.UI.Popups.UICommand("Restart") { Id = 0 }); messageDialog.Commands.Add(new Windows.UI.Popups.UICommand("Main Menu") { Id = 1 }); var result = await messageDialog.ShowAsync(); if ((int)result.Id == 0) { var messageDialog2 = new MessageDialog($"NOTICE! A game of Mine Sweeper costs {Game_Hub.MineSweeperGameCost} Crystals. Are you sure?"); messageDialog2.Commands.Add(new UICommand("Yes") { Id = 0 }); messageDialog2.Commands.Add(new UICommand("No") { Id = 1 }); var result2 = await messageDialog2.ShowAsync(); if ((int)result2.Id == 1) { WinButton(sender, e); return; } if (_IBalanceHandler.GetBalance() < Game_Hub.MineSweeperGameCost) { var messageDialog3 = new MessageDialog("ERROR: you don't have enough crystals!"); messageDialog3.Commands.Add(new UICommand("OK") { Id = 0 }); await messageDialog3.ShowAsync(); return; } _IBalanceHandler.SendTransaction(-Game_Hub.MineSweeperGameCost, null); this.Frame.Navigate(typeof(GameMineSweeperEasy)); } else { this.Frame.Navigate(typeof(GameMineSweeperStart)); } }
private async void TicTacToeClick(object sender, RoutedEventArgs e) { var messageDialog = new MessageDialog($"NOTICE! A game of TicTacToe costs {Game_Hub.TicTacToeGameCost} Crystals. Are you sure?"); messageDialog.Commands.Add(new UICommand("Yes") { Id = 0 }); messageDialog.Commands.Add(new UICommand("No") { Id = 1 }); var result = await messageDialog.ShowAsync(); if ((int)result.Id == 1) { return; } if (_IBalanceHandler.GetBalance() < Game_Hub.TicTacToeGameCost) { var messageDialog2 = new MessageDialog("ERROR: you don't have enough crystals!"); messageDialog2.Commands.Add(new UICommand("OK") { Id = 0 }); await messageDialog2.ShowAsync(); return; } _IBalanceHandler.SendTransaction(-Game_Hub.TicTacToeGameCost, null); this.Frame.Navigate(typeof(GameTicTacToe)); }
public void UpdateBalance(DailyProgressSummary[] progress) { if (progress.IsNullOrEmpty()) { return; } var goals = _goalsRepository.GetGoals(progress.First().UserId); foreach (var summary in progress.Where(summary => summary.DayId != DateTime.Today)) { var crystals = CalculateByDay(summary, goals); if (crystals > 0) { _balanceHandler.SendTransaction(crystals, summary.DayId.ToString()); } } UpadteLastWeek(progress); }
private void Accept(object sender, RoutedEventArgs e) { int index = (int)((Button)sender).Tag; if (textBox.Text != "") { int amount = int.Parse(textBox.Text); ShowMessage($"{player.FirstName} has been rewarded with {amount} crystals."); var activity = activities[index]; _IBalanceHandler.SendTransaction(amount, $"{activity.ActivityType} on {activity.DayId}", player.UserId); } grids[index].Children.Remove(panel); panel.Tag = -1; panel.Visibility = Visibility.Collapsed; }