public New_Coach_Explenations()
        {
            this.InitializeComponent();
            _signInFlow         = ProgramContainer.container.GetInstance <ISignInFlow>();
            _IPlayerRepository  = ProgramContainer.container.GetInstance <IPlayerRepository>();
            _userTypeRepository = ProgramContainer.container.GetInstance <UserTypeRepository>();

            Coach coach = _signInFlow.NewCoachFlow();

            if (Game_Hub.CoachAndPlayer)
            {
                _userTypeRepository.SaveUserType(coach.UserId, UserType.CoachAndPlayer);
                ((SignInFlow)_signInFlow).SaveUserToLocalStorage(UserType.Coach);
            }
            if (coach.FirstName == null)
            {
                this.Frame.Navigate(typeof(New_Coach));
                return;
            }
            welcome.Text = "Hi " + coach.FirstName + ".\n" +
                           "\n" +
                           "You will soon add your first player, but before that you will need to enter your credit card number!\n" +
                           "\n" +
                           "As you recall in boost we use Crystals for games' cost.\n" +
                           "\n" +
                           "1 ILS is worth 100 Crystals so when you reward your player with crystals tha appropriate amount of money will be deducted from your bank account\n" +
                           "\n" +
                           "After that you will add your first player!\n";
        }
 public NewUnassignedPlayerExplenations()
 {
     _signInFlow = ProgramContainer.container.GetInstance <ISignInFlow>();
     this.InitializeComponent();
     _userTypeRepository = ProgramContainer.container.GetInstance <UserTypeRepository>();
     player = _signInFlow.GetPlayer();
     if (Coach_Lobby.CoachAndPlayer)
     {
         _userTypeRepository.SaveUserType(player.UserId, UserType.CoachAndPlayer);
         ((SignInFlow)_signInFlow).SaveUserToLocalStorage(UserType.Player);
     }
     welcome.Text = "Hi " + player.FirstName + ".\n" +
                    "You will soon see the goals your coach assigned you, but first... some explanations about boost\n" +
                    "\n" +
                    "Your coach assigned you daily (and possibly) weekly goals, once you complete a goal you will recive a certian amount of crystals (chosen by your coach). But you can also get crystals if your coach is impressed by a certian activity you had.\n" +
                    "\n" +
                    "You can spend Your crystals in the Game Hub. There you will be able to play cool and exciting games such as Tic Tac Toe !\n" +
                    "\n" +
                    "Are you ready?\n";
 }
Ejemplo n.º 3
0
        void CreateView()
        {
            var listView = new ListView
            {
                ItemsSource  = _db.GetUserTypes(),
                ItemTemplate = new DataTemplate(typeof(TextCell))
            };

            listView.ItemTemplate.SetBinding(TextCell.TextProperty, "Name");
            listView.ItemTemplate.SetBinding(TextCell.DetailProperty, "Id");

            listView.ItemTapped += async(s, e) =>
            {
                var item = (UserType)e.Item;
                if (await DisplayAlert("削除しますか?", item.Name, "OK", "キャンセル"))
                {
                    _db.Delete(item);
                    listView.ItemsSource = _db.GetUserTypes();
                }
            };

            var entry = new Entry
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                BackgroundColor   = Color.White
            };
            var addButton = new Button
            {
                Text         = "Add",
                WidthRequest = 60,
                TextColor    = Color.White
            };

            addButton.Clicked += (s, e) =>
            {
                if (!string.IsNullOrEmpty(entry.Text))
                {
                    var userType = new UserType {
                        Name = entry.Text
                    };
                    if (_db.SaveUserType(userType) == 0)
                    {
                        DisplayAlert("既に使用されています。", userType.Name, "OK");
                    }
                    listView.ItemsSource = _db.GetUserTypes();
                }
                else
                {
                    DisplayAlert("必須入力", "名前を入力して下さい", "OK");
                }
            };



            var backButton = new Button
            {
                Text      = "戻る",
                TextColor = Color.Black
            };

            backButton.Clicked += (s, e) =>
            {
                Navigation.PopModalAsync();
            };


            Content = new StackLayout
            {
                Padding  = new Thickness(0, Device.OnPlatform(20, 0, 0), 0, 0),
                Children =
                {
                    new StackLayout
                    {
                        Padding         = 5,
                        BackgroundColor = Color.Navy,
                        Children        = { entry, addButton }
                    },
                    listView,
                    backButton
                }
            };
        }