void GetList()
 {
     cardList = DataBaseController.instance().GetCardList();
     CardListAdapter adapter = new CardListAdapter(this, cardList);
     adapter.dataRemoved += Adapter_dataRemoved;
     cardViwer.Adapter = adapter;
 }
Exemplo n.º 2
0
        protected async override void OnCreate(Bundle bundle)
        {
            try {
                base.OnCreate(bundle);
                ActionBar.Hide();
                SetContentView(Resource.Layout.card_list_view);

                var cardAdapter = new CardListAdapter(this);

                var listView = FindViewById <ListView> (Resource.Id.list_cards);
                listView.Adapter = cardAdapter;
                string content;

                using (StreamReader sr = new StreamReader(Assets.Open("card-data.txt")))
                {
                    content = sr.ReadToEnd();
                }

                var data = JsonConvert.DeserializeObject <GamePlayRoot>(content);

                if (data != null)
                {
                    var test = data.GamePlay.RuleSet.RuleMatches.ToList();
                    cardAdapter.Cards = test;
                }

                listView.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) => {
                    var item = cardAdapter.Cards[e.Position];

                    var myIntent = new Intent(this, typeof(CardDescriptionActivity));
                    myIntent.PutExtra("cardDetails", JsonConvert.SerializeObject(item));

                    StartActivity(myIntent);
                };
            }
            catch (Exception ex) {
                throw;
            }
        }