示例#1
0
        public void RefreshTests()
        {
            IEnumerable <Test> tests = DBController.Instance.GetTests();

            if (tests != null)
            {
                TestListAdapter tla     = new TestListAdapter(this, tests.ToArray());
                ListView        lvTests = FindViewById <ListView>(Resource.Id.lvTests);
                lvTests.Adapter    = tla;
                lvTests.ItemClick += LvTests_ItemClick;
            }
        }
示例#2
0
        public override bool OnContextItemSelected(IMenuItem item)
        {
            switch (item.ItemId)
            {
            case 1:
            {
                ListView lvTests               = FindViewById <ListView>(Resource.Id.lvTests);
                AdapterContextMenuInfo info    = item.MenuInfo as AdapterContextMenuInfo;
                TestListAdapter        adapter = lvTests.Adapter as TestListAdapter;
                DBController.Instance.DeleteTest(adapter[info.Position]);
                RefreshTests();
                return(true);
            }

            default:
            {
                return(base.OnContextItemSelected(item));
            }
            }
        }