Exemplo n.º 1
0
        private void AddPlayer(object sender, int position)
        {
            ListView listview = (ListView)sender;
            ZonePlayersListAdapter adapter = listview.Adapter as ZonePlayersListAdapter;

            zoneAdapter = adapter;
            DbPlayer player = adapter.GetItem(position);

            if (player == null)
            {
                AlertDialog.Builder builder  = new AlertDialog.Builder(Activity);
                LayoutInflater      inflater = LayoutInflater;
                View view = inflater.Inflate(Resource.Layout.select_player_layout, null);

                ListView playerList = view.FindViewById <ListView>(Resource.Id.playerList);
                playerList.Adapter    = new DetailedPlayerListAdapter(myVieWModel.GetPlayers(), Activity);
                playerList.ItemClick += PlayerList_ItemClick;
                //string text = MainViewModel.Instance.GetDb().ToString();
                builder.SetView(view)
                .SetNegativeButton("Cancel", (s, args) => {
                });

                alert = builder.Create();
                alert.Show();
            }
        }
Exemplo n.º 2
0
        private void PlayerList_ItemClick(object sender, AdapterView.ItemClickEventArgs e)
        {
            ListView listview = (ListView)sender;
            DetailedPlayerListAdapter adapter = listview.Adapter as DetailedPlayerListAdapter;
            DbPlayer player = adapter.GetItem(e.Position);

            zoneAdapter.Add(player);
            addPlayerAction.Invoke(player);
            zoneAdapter = null;
            alert.Cancel();
        }