Example #1
0
        public SearchResultsViewModel()
        {
            //Setup handlers
            ApplicationService.GetChatViewModel.OnUsersSearchResultChanged((sender, args) => onUsersSearchResultChanged(args));
            ApplicationService.GetChatViewModel.OnGroupSearchResultChanged((sender, args) => onGroupSearchResultChanged(args));

            //Set results
            var users  = ApplicationService.UsersSearchResult;
            var groups = ApplicationService.GroupsSearchResult;

            if (users != null)
            {
                UsersSearchResults = new ContactsListViewModel(users);
            }

            if (groups != null)
            {
                GroupsSearchResults = new GroupsListViewModel(groups);
            }
        }
Example #2
0
        async void loadInfo(Contact contact)
        {
            if (contact == null)
            {
                return;
            }

            //Set user info
            UserInfo = contact;

            //If it's your account, than add contacts list
            if (IsYourAccaunt)
            {
                //Add on user data changed handler
                UnitOfWork.AddUserInfoUpdatedHandler((sender, args) => OnUserUpdates(sender, args));

                //Load contacts info
                var contactsList = await UnitOfWork.GetUsersInfo(new List <int>(UnitOfWork.User.contactsIdList));

                if (contactsList != null)
                {
                    ContactsList = new ContactsListViewModel(contactsList, false, false, false, true);
                }
            }

            //If it's not your account, add groups list
            else
            {
                //Make request to the server and get groups list
                GroupsList = new GroupsListViewModel(await UnitOfWork.GetUserGroupsInfo(UserInfo));
            }


            //Update UI
            OnPropertyChanged("UserName");
            OnPropertyChanged("Bio");
            OnPropertyChanged("Email");
            OnPropertyChanged("IsYourContact");
            OnPropertyChanged("IsYourAccaunt");
            OnPropertyChanged("GroupsList");
        }
Example #3
0
 void onGroupSearchResultChanged(List <Group> dataChanged)
 {
     GroupsSearchResults = new GroupsListViewModel(dataChanged);
 }