Example #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;
        }
Example #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Forms.Forms.Init(this, savedInstanceState);

            SetContentView(Resource.Layout.GroupsMainScreen);
            GroupsService groupsService  = new GroupsService();
            ListView      groupsListView = FindViewById <ListView>(Resource.Id.GroupsListView);

            groupsListView.ChoiceMode = ChoiceMode.Multiple;
            Button btnAddGroup = FindViewById <Button>(Resource.Id.btnAddGroup);

            allGroups = groupsService.GetAll().ToList();

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

            groupsListView.Adapter = adapter;


            btnAddGroup.Click += BtnAddGroup_Click;

            groupsListView.ItemClick += GroupsListView_ItemClick;

            groupsListView.ItemLongClick += GroupsListView_ItemLongClick;
        }