private async Task Initialize() { await Task.Run(() => { users = GlobalVariables.followersViewModel.GetUserList(petpicturesid); List <ListViewWithPictureAndSomeText> listViewWithPictureAndSomeText = new List <ListViewWithPictureAndSomeText>(); foreach (var item in users) { ListViewWithPictureAndSomeText listViewWith = new ListViewWithPictureAndSomeText() { user = item, Name = item.LastName + " " + item.FirstName //pet = thisPet }; if (!String.IsNullOrEmpty(item.ProfilePictureURL)) { listViewWith.ProfilePicture = ImageSource.FromUri(new Uri(item.ProfilePictureURL)); } else { listViewWith.ProfilePicture = ""; } listViewWithPictureAndSomeText.Add(listViewWith); } Device.BeginInvokeOnMainThread(() => { userListView.ItemsSource = listViewWithPictureAndSomeText; userListView.IsRefreshing = false; }); }); }
private async void InitializeUserFollowingList() { await Task.Run(() => { pets = GlobalVariables.followersViewModel.GetPetList(followings); List <ListViewWithPictureAndSomeText> listViewWithPictureAndSomeText = new List <ListViewWithPictureAndSomeText>(); foreach (var item in pets) { ListViewWithPictureAndSomeText listViewWith = new ListViewWithPictureAndSomeText() { pet = item, Name = item.Name }; if (item.Profilepicture != null) { listViewWith.ProfilePicture = ImageSource.FromStream(() => new System.IO.MemoryStream(item.Profilepicture)); } else { listViewWith.ProfilePicture = ""; } listViewWithPictureAndSomeText.Add(listViewWith); } Device.BeginInvokeOnMainThread(() => { userListView.ItemsSource = listViewWithPictureAndSomeText; userListView.IsRefreshing = false; }); }); }
private async Task Initialize() { await Task.Run(() => { users = GlobalVariables.whosLikedViewModel.GetUserList(petpicturesid); List <ListViewWithPictureAndSomeText> listViewWithPictureAndSomeText = new List <ListViewWithPictureAndSomeText>(); foreach (var item in users) { ListViewWithPictureAndSomeText listViewWith = new ListViewWithPictureAndSomeText() { user = item, Name = item.LastName + " " + item.FirstName //pet = thisPet }; if (item.ProfilePicture != null) { listViewWith.ProfilePicture = ImageSource.FromStream(() => new System.IO.MemoryStream(item.ProfilePicture)); } else { listViewWith.ProfilePicture = ""; } listViewWithPictureAndSomeText.Add(listViewWith); } Device.BeginInvokeOnMainThread(() => { userListView.ItemsSource = listViewWithPictureAndSomeText; userListView.IsRefreshing = false; }); }); }
private async void InitializePetFollowingList() { await Task.Run(() => { List <ListViewWithPictureAndSomeText> listViewWithPictureAndSomeText = new List <ListViewWithPictureAndSomeText>(); foreach (var item in users) { ListViewWithPictureAndSomeText listViewWith = new ListViewWithPictureAndSomeText() { user = item, Name = item.LastName + " " + item.FirstName }; if (item.ProfilePicture != null) { listViewWith.ProfilePicture = ImageSource.FromStream(() => new System.IO.MemoryStream(item.ProfilePicture)); } else { listViewWith.ProfilePicture = ""; } listViewWithPictureAndSomeText.Add(listViewWith); } Device.BeginInvokeOnMainThread(() => { userListView.ItemsSource = listViewWithPictureAndSomeText; userListView.IsRefreshing = false; }); }); }
private async Task InitializeBlockedUserList() { await Task.Run(() => { Device.BeginInvokeOnMainThread(() => { userListView.ItemsSource = null; }); List <ListViewWithPictureAndSomeText> listViewWithPictureAndSomeText = new List <ListViewWithPictureAndSomeText>(); var blockedUserList = GlobalVariables.blockedPeopleViewModel.GetBlockedPeoples(); if (blockedUserList != null && blockedUserList.Count != 0) { foreach (var item in blockedUserList) { var blockedUser = GlobalVariables.databaseConnection.GetUserByID(item.BlockedUserID); ListViewWithPictureAndSomeText listViewWith = new ListViewWithPictureAndSomeText() { user = GlobalVariables.databaseConnection.GetUserByID(blockedUser.id), Name = blockedUser.LastName + " " + blockedUser.FirstName, blockedPeople = item }; listViewWith.ProfilePicture = ImageSource.FromStream(() => new System.IO.MemoryStream(blockedUser.ProfilePicture)); listViewWithPictureAndSomeText.Add(listViewWith); } } Device.BeginInvokeOnMainThread(() => { userListView.ItemsSource = listViewWithPictureAndSomeText; if (listViewWithPictureAndSomeText.Any()) { IsEmptyLystLabel.IsVisible = false; } else { IsEmptyLystLabel.IsVisible = true; } userListView.IsRefreshing = false; }); }); }