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 CoachViewPlayerStart() { this.InitializeComponent(); _signInFlow = ProgramContainer.container.GetInstance <ISignInFlow>(); _IBalanceHandler = ProgramContainer.container.GetInstance <IBalanceHandler>(); _IGoalsHandler = ProgramContainer.container.GetInstance <IGoalsHandler>(); _ICoachPlayersPage = ProgramContainer.container.GetInstance <ICoachPlayersPage>(); Player player = (_ICoachPlayersPage.GetPlayers())[Coach_View_Players.Tag]; string FullName = player.FirstName + player.LastName; welcome.Text = $"Viewing {FullName}'s Activities and Summaries\n"; crystals.Text = $"{FullName} has {_IBalanceHandler.GetBalance(player.UserId)} crystals!\n"; }
public Game_Hub() { this.InitializeComponent(); _signInFlow = ProgramContainer.container.GetInstance <ISignInFlow>(); _IBalanceHandler = ProgramContainer.container.GetInstance <IBalanceHandler>(); _IUserTypeRepository = ProgramContainer.container.GetInstance <UserTypeRepository>(); player = _signInFlow.GetPlayer(); CoachAndPlayer = false; if (_IUserTypeRepository.GetUserType(player.UserId).UserType == UserType.CoachAndPlayer) { ToBeACoach.Content = "Switch to Coach mode"; } welcome.Text = "Hey " + player.FirstName + ", welcome to the game hub\n"; crystals.Text = "You have " + _IBalanceHandler.GetBalance() + " crystals!\n"; }
public ScheduledToastNotification GetNotification(string userId, string name) { var balance = _balanceHandler.GetBalance(userId); if (balance <= 0) { return(null); } var title = String.Concat(name, " dont't Forget!"); var content = "You still have crystals waiting for you!"; var notificationContent = _builder.Build(title, content); var notification = new ScheduledToastNotification(notificationContent.GetXml(), NotificationTimes.GetTimeToNotify(NotificationTimes.CrystalsHour)); notification.Tag = "Crystals"; return(notification); }