private async void beACoach(object sender, RoutedEventArgs e) { if (_IUserTypeRepository.GetUserType(player.UserId).UserType == UserType.CoachAndPlayer) { ((SignInFlow)_signInFlow).SaveUserToLocalStorage(UserType.Coach); Coach coach = _signInFlow.GetCoach(); if (coach.FirstName == null) //The coach doesn't have a health account - should not happen. { var messageDialog = new MessageDialog("Hi new coach, we noticed you don't have a microsoft health account. Please go to microsoft's health app and create one."); messageDialog.Commands.Add(new UICommand("OK") { Id = 0 }); var result = await messageDialog.ShowAsync(); _signInFlow.SignOut(); return; } else if (coach.PaymentLastDigits == "") //the coach hasn't completed his sign up { var messageDialog = new MessageDialog("Hey! We noticed you haven't completed your Sign In, so we will now continue!"); messageDialog.Commands.Add(new UICommand("OK") { Id = 0 }); var result = await messageDialog.ShowAsync(); this.Frame.Navigate(typeof(New_Coach_CreditCard)); } else //the coach is OK. { this.Frame.Navigate(typeof(Coach_Lobby)); } } else { var messageDialog = new MessageDialog("NOTICE! In order to be a coach you will need to enter a payment method and have a player. 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; } CoachAndPlayer = true; this.Frame.Navigate(typeof(New_Coach_Explenations)); } }
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"; }