Ejemplo n.º 1
0
        private void Init()
        {
            SleepRepository sleepRepository = new SleepRepository();
            var             end             = DateTime.Now;
            var             start           = end.AddDays(-30);
            var             sleeps          = sleepRepository.GetSleepRecords(player.UserId, start, end);
            int             NumOfSleeps     = sleeps.Length;

            AddPageTitle(inner, "Sleep summaries:");
            if (NumOfSleeps == 0)
            {
                ShowMessage("No recent sleep records available. Go take a nap!");
                return;
            }
            for (int i = 0; i < NumOfSleeps; i++)
            {
                AddSleepSummaryToGrid(sleeps[i], i + 1);
            }
        }
Ejemplo n.º 2
0
        private void Init()
        {
            SleepRepository sleepRepository = new SleepRepository();
            var             end             = DateTime.Now;
            var             start           = end.AddDays(-30);

            sleeps = _sleepFetcher.GetSleepDuringSpan(start, end, player.UserId);
            int NumOfSleeps = sleeps.Length;

            AddPageTitle(inner, player.FirstName + "'s sleep summaries:");
            if (NumOfSleeps == 0)
            {
                ShowMessage("No recent sleep records available. Tell your player to take a nap!");
                return;
            }
            grids = new Grid[NumOfSleeps];
            for (int i = 0; i < NumOfSleeps; i++)
            {
                AddActivitySummaryToGrid(i);
            }
            panel = new Grid
            {
                VerticalAlignment   = VerticalAlignment.Stretch,
                HorizontalAlignment = HorizontalAlignment.Stretch,
                Background          = CoachRewardActivityGridBackgroundColorBrush,
                Tag  = -1,                //current index
                Name = "RewardPanel",
            };
            textBlock = new TextBlock
            {
                Text     = "How many crystals would you like to give to your user?",
                FontSize = 15,
            };
            textBox = new TextBox
            {
                Name = "RewardTextBox",
            };
            textBox.TextChanged += new TextChangedEventHandler(RewardTextBoxChanged);
            buttonAccept         = new Button
            {
                Content             = "Confirm",
                Background          = MainPage.getButtonColorBrush(),
                VerticalAlignment   = VerticalAlignment.Center,
                HorizontalAlignment = HorizontalAlignment.Center,
                FontSize            = 15,
            };
            buttonCancel = new Button
            {
                Content             = "Cancel",
                Background          = LogOutButtonColorBrush,
                VerticalAlignment   = VerticalAlignment.Center,
                HorizontalAlignment = HorizontalAlignment.Center,
                FontSize            = 15,
            };
            buttonAccept.Click += new RoutedEventHandler(Accept);
            buttonCancel.Click += new RoutedEventHandler(Cancel);
            for (int i = 0; i < 4; i++)
            {
                RowDefinition row2 = new RowDefinition();
                row2.Height = new GridLength(1, GridUnitType.Star);
                panel.RowDefinitions.Add(row2);
            }
            panel.Children.Add(textBlock);
            textBlock.SetValue(Grid.RowProperty, 0);
            panel.Children.Add(textBox);
            textBox.SetValue(Grid.RowProperty, 1);
            panel.Children.Add(buttonAccept);
            buttonAccept.SetValue(Grid.RowProperty, 2);
            panel.Children.Add(buttonCancel);
            buttonCancel.SetValue(Grid.RowProperty, 3);

            panel.SetValue(Grid.RowSpanProperty, 20);
            panel.SetValue(Grid.RowProperty, 2);
            panel.SetValue(Grid.ColumnSpanProperty, 2);
            panel.Visibility = Visibility.Collapsed;
        }