Esempio n. 1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.ManageContactGroups);

            GroupsService groupsService = new GroupsService();

            groups    = groupsService.GetAll().ToList();
            allGroups = groupsService.GetAll().ToList();
            MainActivity.SelectedContact.Groups = groupsService.GetAllByContactID(MainActivity.SelectedContact.ID).ToList();

            ListView groupsListView = FindViewById <ListView>(Resource.Id.listViewGroups);
            Button   btnUpdate      = FindViewById <Button>(Resource.Id.btnUpdateGroups);

            GroupsViewAdapter adapter = new GroupsViewAdapter(this, Resource.Layout.ViewModel, allGroups);

            groupsListView.Adapter    = adapter;
            groupsListView.ChoiceMode = ChoiceMode.Multiple;

            //populates all user contact and selects the ones that the contact participates
            groupsListView.ChildViewAdded += GroupsListView_ChildViewAdded;

            //selects and deselects groups /*ONCLICK BUG */
            groupsListView.ItemClick += GroupsListView_ItemClick;

            //refreshes the groups of the current contact
            btnUpdate.Click += BtnUpdate_Click;
        }