Ejemplo n.º 1
0
 public Coach_View_Players()
 {
     InitializeComponent();
     _signInFlow        = ProgramContainer.container.GetInstance <ISignInFlow>();
     _ICoachPlayersPage = ProgramContainer.container.GetInstance <ICoachPlayersPage>();
     Player[] players = _ICoachPlayersPage.GetPlayers();
     for (int i = 0; i < players.Length; i++)
     {
         inner.RowDefinitions.Add(new RowDefinition());
         Button butt = new Button()
         {
             Content    = (players[i].FirstName != "") ? players[i].FirstName + " " + players[i].LastName : "Code: " + players[i].UserId,
             Background = ButtonColorBrush,
             Foreground = ButtonTextColorBrush,
             Tag        = i,              //Player number in coach's list.
         };
         butt.SetValue(Grid.RowProperty, i);
         butt.SetValue(HorizontalAlignmentProperty, HorizontalAlignment.Center);
         if (players[i].FirstName != "")
         {
             butt.Click += new RoutedEventHandler(button_view_player_goals);
         }
         else
         {
             butt.Click += new RoutedEventHandler(UnassignedPlayerClick);
         }
         inner.Children.Add(butt);
     }
 }
        private async void button_Click(object sender, RoutedEventArgs e)
        {
            if (ActiveMinutes_textBox.Text == "" && Calories_textBox.Text == "")
            {
                var messageDialog = new MessageDialog("You have'nt enter any goal, Goals will remain as they were. Are you sure?");
                messageDialog.Commands.Add(new UICommand("Yes. I am sure")
                {
                    Id = 0
                });
                messageDialog.Commands.Add(new UICommand("No. I want to change")
                {
                    Id = 1
                });
                var result = await messageDialog.ShowAsync();

                if ((int)result.Id == 0)
                {
                    this.Frame.Navigate(typeof(CoachViewPlayerWeeklyGoals));
                    return;
                }
                else                 // id == 1
                {
                    return;
                }
            }
            string ID                  = (_ICoachPlayersPage.GetPlayers())[Coach_View_Players.Tag].UserId;
            int    ActiveMinutes       = (ActiveMinutes_textBox.Text == "")            ? -1 : int.Parse(ActiveMinutes_textBox.Text);
            int    ActiveMinutesReward = (ActiveMinutesReward_textBox.Text == "")      ? 0  : int.Parse(ActiveMinutesReward_textBox.Text);

            int caloriesAmount = (Calories_textBox.Text == "")                         ? -1 : int.Parse(Calories_textBox.Text);
            int caloriesReward = (CaloriesReward_textBox.Text == "")           ? 0  : int.Parse(CaloriesReward_textBox.Text);

            _IGoalsHandler.SetWeeklyGoals(ID, ActiveMinutes, ActiveMinutesReward, caloriesAmount, caloriesReward);
            this.Frame.Navigate(typeof(CoachViewPlayerWeeklyGoals));
        }
Ejemplo n.º 3
0
 public CoachRemovePlayer()
 {
     InitializeComponent();
     _signInFlow        = ProgramContainer.container.GetInstance <ISignInFlow>();
     _ICoachPlayersPage = ProgramContainer.container.GetInstance <ICoachPlayersPage>();
     _IPlayerRepository = ProgramContainer.container.GetInstance <IPlayerRepository>();
     Player[] players = _ICoachPlayersPage.GetPlayers();
     for (int i = 0; i < players.Length; i++)
     {
         if (players[i].FirstName == "")
         {
             continue;
         }
         inner.RowDefinitions.Add(new RowDefinition());
         Button butt = new Button()
         {
             Content    = players[i].FirstName + " " + players[i].LastName,
             Background = LogOutButtonColorBrush,
             Tag        = i,              //Player number in coach's list.
         };
         butt.SetValue(Grid.RowProperty, i);
         butt.SetValue(HorizontalAlignmentProperty, HorizontalAlignment.Center);
         butt.Click += new RoutedEventHandler(RemovePlayerClick);
         inner.Children.Add(butt);
     }
 }
 public CoachViewPlayerComparison()
 {
     this.InitializeComponent();
     _signInFlow        = ProgramContainer.container.GetInstance <ISignInFlow>();
     _CompareUser       = ProgramContainer.container.GetInstance <ICompareUser>();
     _ICoachPlayersPage = ProgramContainer.container.GetInstance <ICoachPlayersPage>();
     player             = (_ICoachPlayersPage.GetPlayers())[Coach_View_Players.Tag];
     Init();
 }
 public CoachViewPlayerWeeklyGoals()
 {
     this.InitializeComponent();
     _signInFlow        = ProgramContainer.container.GetInstance <ISignInFlow>();
     _IProgressFetcher  = ProgramContainer.container.GetInstance <IProgressFetcher>();
     _IGoalsHandler     = ProgramContainer.container.GetInstance <IGoalsHandler>();
     _ICoachPlayersPage = ProgramContainer.container.GetInstance <ICoachPlayersPage>();
     player             = (_ICoachPlayersPage.GetPlayers())[Coach_View_Players.Tag];
     InitAllProgressBars(inner, DateTime.Now, 0);
 }
Ejemplo n.º 6
0
        public CoachEditPlayerGoals()
        {
            this.InitializeComponent();

            _signInFlow        = ProgramContainer.container.GetInstance <ISignInFlow>();
            _ICoachPlayersPage = ProgramContainer.container.GetInstance <ICoachPlayersPage>();
            _IGoalsHandler     = ProgramContainer.container.GetInstance <IGoalsHandler>();
            player             = (_ICoachPlayersPage.GetPlayers())[Coach_View_Players.Tag];
            InitializeTextBoxes();
        }
        public CoachViewPlayerRecentActivities()
        {
            this.InitializeComponent();
            _signInFlow        = ProgramContainer.container.GetInstance <ISignInFlow>();
            _ICoachPlayersPage = ProgramContainer.container.GetInstance <ICoachPlayersPage>();
            _activityFetcher   = ProgramContainer.container.GetInstance <IActivityFetcher>();
            _IBalanceHandler   = ProgramContainer.container.GetInstance <IBalanceHandler>();

            player = (_ICoachPlayersPage.GetPlayers()[Coach_View_Players.Tag]);
            Init();
        }
Ejemplo n.º 8
0
        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 CoachEditPlayerWeeklyGoals()
        {
            this.InitializeComponent();
            _signInFlow        = ProgramContainer.container.GetInstance <ISignInFlow>();
            _ICoachPlayersPage = ProgramContainer.container.GetInstance <ICoachPlayersPage>();
            _IGoalsHandler     = ProgramContainer.container.GetInstance <IGoalsHandler>();
            welcome.Text       = "Hi " + _signInFlow.GetCoach().FirstName + " \nPlease reset your player's weekly goals.";

            Goals goal = _IGoalsHandler.GetGoals((_ICoachPlayersPage.GetPlayers()[Coach_View_Players.Tag]).UserId);

            ActiveMinutes_textBox.Text = (goal.WeeklyActiveMinutes > 0) ? goal.WeeklyActiveMinutes.ToString() : "";
            Calories_textBox.Text      = (goal.WeeklyCaloriesBurned > 0) ? goal.WeeklyCaloriesBurned.ToString() : "";

            ActiveMinutesReward_textBox.Text       = (goal.WeeklyActiveMinutes > 0) ? goal.WeeklyActiveMinutesReward.ToString() : "";
            ActiveMinutesReward_textBox.Visibility = (goal.WeeklyActiveMinutes > 0) ? Visibility.Visible : Visibility.Collapsed;
            ActiveMinutesReward.Visibility         = (goal.WeeklyActiveMinutes > 0) ? Visibility.Visible : Visibility.Collapsed;

            CaloriesReward_textBox.Text       = (goal.WeeklyCaloriesBurned > 0) ? goal.WeeklyCaloriesBurnedReward.ToString() : "";
            CaloriesReward_textBox.Visibility = (goal.WeeklyCaloriesBurned > 0) ? Visibility.Visible : Visibility.Collapsed;
            CaloriesReward.Visibility         = (goal.WeeklyCaloriesBurned > 0) ? Visibility.Visible : Visibility.Collapsed;
        }
Ejemplo n.º 10
0
        private async void RemovePlayerClick(object sender, RoutedEventArgs e)
        {
            Player player        = _ICoachPlayersPage.GetPlayers()[(int)((Button)sender).Tag];
            string msg           = "Are you sure you want to remove " + player.FirstName + " " + player.LastName + " from your players list?";
            var    messageDialog = new MessageDialog(msg);

            messageDialog.Commands.Add(new Windows.UI.Popups.UICommand("Yes")
            {
                Id = 0
            });
            messageDialog.Commands.Add(new Windows.UI.Popups.UICommand("No")
            {
                Id = 1
            });
            var result = await messageDialog.ShowAsync();

            if ((int)result.Id == 1)
            {
                return;
            }
            _IPlayerRepository.RemovePlayer(player.UserId);

            this.Frame.Navigate(typeof(Coach_View_Players));
        }