Ejemplo n.º 1
0
        public void OnClick(View v)
        {
            if (v.Id == btn_arm.Id)
            {
                ArmTrap();
            }
            else if (v is ButtonChooseTrap)
            {
                ButtonChooseTrap button = (ButtonChooseTrap)v;

                SelectTrap(button.TrapKey);
            }
        }
Ejemplo n.º 2
0
        private void LoadUserTraps()
        {
            try
            {
                if (AppStatus.UserLogged.ContainsTraps())
                {
                    AppStatus.UserLogged.Traps = AppStatus.UserLogged.Traps.ToList();

                    foreach (UserTrapApiResult trapUser in AppStatus.UserLogged.Traps.Where(obj => obj.Amount > 0).ToList())
                    {
                        userAvailableTraps.Add(trapUser);

                        ButtonChooseTrap btnTrap = new ButtonChooseTrap(Activity.ApplicationContext);

                        var layoutParameters = new LinearLayout.LayoutParams(160, 160);

                        layoutParameters.SetMargins(10, 5, 10, 5);

                        btnTrap.LayoutParameters = layoutParameters;

                        btnTrap.TrapKey = trapUser.NameKey;

                        btnTrap.SetOnClickListener(this);

                        group_arm_choose_traps.AddView(btnTrap);

                        buttonsForChoose.Add(btnTrap);
                    }

                    UnselectTraps();
                }
                else if (!AppStatus.UserLogged.ContainsTraps())
                {
                    //Nao pode armar pois nao possui
                    return;
                }
            }
            catch (Exception exception)
            {
                InsightsUtils.LogException(exception);
            }
        }