private async void Initialize() { await Task.Run(() => { user = GlobalVariables.databaseConnection.GetUserByID(userID); if (user.ProfilePicture != null) { Device.BeginInvokeOnMainThread(() => { currentWidth = Application.Current.MainPage.Width; optimalWidth = currentWidth / 3; profilePictureImage.HeightRequest = optimalWidth; profilePictureImage.WidthRequest = optimalWidth; profilePictureImage.Source = ImageSource.FromStream(() => new System.IO.MemoryStream(user.ProfilePicture)); }); } Device.BeginInvokeOnMainThread(() => { currentWidth = Application.Current.MainPage.Width; optimalWidth = currentWidth / 5; Title = user.FirstName + " " + user.LastName; }); if (!GlobalVariables.seeAnOwnerProfileViewModel.IsItABlockedUser(GlobalVariables.ActualUser.id, userID))//ha nem blokkolt { Task.Run(() => { petList = GlobalVariables.seeAnOwnerProfileViewModel.GetPet(user.id); List <ImageAndText> imageAndTexts = new List <ImageAndText>(); ToolbarItem MoreToolbarItem = new ToolbarItem() { Icon = "more.png", Priority = 0 }; MoreToolbarItem.Clicked += ReportToolbarItem_Clicked; Device.BeginInvokeOnMainThread(() => { NavigationPage.SetHasNavigationBar(this, true); ToolbarItems.Add(MoreToolbarItem); blockedLabel.IsVisible = false; //petsLabel.IsVisible = true; followingLabel.IsVisible = true; followersTextLabel.IsVisible = true; petListStackLayout.IsVisible = true; GetFollowings(); }); Device.BeginInvokeOnMainThread(() => { foreach (var item in petList) { imageAndTexts.Add(new ImageAndText() { Pet = item, Name = item.Name, ProfilePictureURL = ImageSource.FromStream(() => new System.IO.MemoryStream(item.Profilepicture)) }); Frame frame = new Frame() { //BorderColor = Color.LightGray, //Padding = 10, //BackgroundColor = Color.FromHex("#F5F6F8") BackgroundColor = Color.White }; StackLayout stackLayout = new StackLayout() { Orientation = StackOrientation.Vertical }; CircleImage petProfilePictureImage = new CircleImage { HeightRequest = 55, WidthRequest = 55, Aspect = Aspect.AspectFill, HorizontalOptions = LayoutOptions.Center, Source = ImageSource.FromStream(() => new System.IO.MemoryStream(item.Profilepicture)) }; Label nameLabel = new Label() { Text = item.Name, HorizontalOptions = LayoutOptions.Center, TextColor = Color.Black }; stackLayout.GestureRecognizers.Add(new TapGestureRecognizer() { NumberOfTapsRequired = 1, TappedCallback = delegate { TapPet(item.id); } }); stackLayout.Children.Add(petProfilePictureImage); stackLayout.Children.Add(nameLabel); frame.Content = stackLayout; petListStackLayout.Children.Add(frame); } }); }); } else { Device.BeginInvokeOnMainThread(() => { blockedLabel.Text = English.BlockedUser(); blockedLabel.IsVisible = true; //petsLabel.IsVisible = false; followingLabel.IsVisible = false; followersTextLabel.IsVisible = false; petListStackLayout.IsVisible = false; }); } }); }