internal static FBUser.FBUser CreateFriend(User i_User) { FBUser.FBUser user = new FBUser.FBUser(i_User.Id); List <Task> tasks = new List <Task>(); tasks.Add(Task.Run(() => user.m_Album = AlbumUtils.SetAlbums(i_User))); tasks.Add(Task.Run(() => user.m_About = AboutUtils.BuildPersonalDetails(i_User))); tasks.Add(Task.Run(() => { while ((user.m_About == null) || (user.m_Album == null)) { Thread.Sleep(sr_SleepFor); } user.m_About.Cover = AlbumUtils.SetCoverPhoto(user.m_Album); })); tasks.Add(Task.Run(() => { while (user.m_About == null) { Thread.Sleep(sr_SleepFor); } user.m_UserPosts = PostUtils.SetPosts(ref user, i_User.Posts, i_User.ImageSmall, user.m_About.Name); })); Task.WaitAll(tasks.ToArray()); return(user); }
private void openGreetingCardSelector(FBUser.FBUser i_Friend) { initPanel(); int counter = 0; foreach (string cardName in Server.GetAllCardsOptions()) { picture = new PictureBox(); picture.ImageLocation = "../../../GreetingCard/img/cardPick" + counter + ".png"; picture.BackgroundImageLayout = ImageLayout.Zoom; picture.Size = new Size(80, 80); picture.Name = cardName; picture.Location = new Point(50, 10 + (110 * counter)); picture.Tag = i_Friend; picture.MouseClick += CardPicker_MouseClick; outerPanel.Controls.Add(picture); label = new Label(); label.Text = cardName + " card"; label.Size = new Size(100, 20); label.Location = new Point(picture.Location.X + 100, picture.Location.Y + 35); outerPanel.Controls.Add(label); counter++; } this.Controls.Add(outerPanel); outerPanel.BringToFront(); }
internal static List <Image> GetUserAndFriendPhotos(FBUser.FBUser i_FriendToSend) { return(new List <Image>() { i_FriendToSend.m_About.ProfilePicture, Server.m_User.m_About.ProfilePicture }); }
internal static List <string> GetUserAndFriendsNames(FBUser.FBUser i_FriendToSend) { return(new List <string>() { i_FriendToSend.m_About.Name, Server.m_User.m_About.Name }); }
public Post(FBUser i_Author, string i_PostCaption, string i_PostContent, DateTime?i_PostCreateTime, int i_AmountOfLikes, int i_AmountOfComments, Image i_PostProfileImage, string i_PostContentImageUrl) { this.PostId = s_PostId++; this.Author = i_Author; this.PostContent = i_PostContent; this.PostCaption = i_PostCaption; this.PostCreateTime = i_PostCreateTime.HasValue ? i_PostCreateTime.Value : new DateTime(); this.AmountOfLikes = i_AmountOfLikes; this.AmountOfComments = i_AmountOfComments; this.PostProfileImage = i_PostProfileImage; this.PostContentImageUrl = i_PostContentImageUrl; this.IsLikedByUser = false; }
internal static string GetFriendAge(FBUser.FBUser i_Friend) { string age = string.Empty; try { age = ((int)(DateTime.Now - DateTime.Parse(i_Friend.m_About.Birthday)).TotalDays / 365).ToString(); } catch (Exception e) { Random randomAge = new Random(); age = randomAge.Next(10, 70).ToString(); } return(age); }
internal static List <Image> GetFriendTaggedPhotosOfUser(FBUser.FBUser i_Friend) { List <Image> photosWithFriendTag = new List <Image>(); foreach (Album album in Server.m_User.m_Album) { foreach (Photo photo in album.Photos) { if (photo.TaggedPeopleIds.Contains(i_Friend.UserId)) { photosWithFriendTag.Add(Image.FromFile(photo.PictureNormalURL)); } } } return(photosWithFriendTag); }
internal static FBUser.FBUser CreateUser(User i_User) { FBUser.FBUser user = new FBUser.FBUser(i_User.Id); List <Task> tasks = new List <Task>(); tasks.Add(Task.Run(() => { UpdateStatus(string.Format(s_StartingStatus, "albums")); user.m_Album = AlbumUtils.SetAlbums(i_User); UpdateStatus(string.Format(s_FinishStatus, "albums")); })); tasks.Add(Task.Run(() => { UpdateStatus(string.Format(s_StartingStatus, "personal details")); user.m_About = AboutUtils.BuildPersonalDetails(i_User); UpdateStatus(string.Format(s_FinishStatus, "personal details")); })); tasks.Add(Task.Run(() => { while ((user.m_About == null) || (user.m_Album == null)) { Thread.Sleep(sr_SleepFor); } UpdateStatus(string.Format(s_StartingStatus, "cover photo")); user.m_About.Cover = AlbumUtils.SetCoverPhoto(user.m_Album); UpdateStatus(string.Format(s_FinishStatus, "cover photo")); })); tasks.Add(Task.Run(() => { while (user.m_About == null) { Thread.Sleep(sr_SleepFor); } UpdateStatus(string.Format(s_StartingStatus, "post")); user.m_UserPosts = PostUtils.SetPosts(ref user, i_User.Posts, i_User.ImageSmall, user.m_About.Name); UpdateStatus(string.Format(s_FinishStatus, "post")); })); tasks.Add(Task.Run(() => { UpdateStatus(string.Format(s_StartingStatus, "friends")); user.m_FriendsList = FriendUtils.SetFriends(i_User.Friends); UpdateStatus(string.Format(s_FinishStatus, "friends")); })); tasks.Add(Task.Run(() => { UpdateStatus(string.Format(s_StartingStatus, "groups")); user.m_UserGroups = GroupUtils.SetGroups(i_User.Groups); UpdateStatus(string.Format(s_FinishStatus, "group")); })); tasks.Add(Task.Run(() => { while ((user.m_FriendsList == null) || (user.m_UserPosts == null)) { Thread.Sleep(sr_SleepFor); } UpdateStatus(string.Format(s_StartingStatus, "feed")); user.m_Feed = new Feed(FeedUtils.BuildUserFeed(user)); UpdateStatus(string.Format(s_FinishStatus, "feed")); })); Task.WaitAll(tasks.ToArray()); return(user); }
internal static Form GetGreetingCard(string i_Name, FBUser.FBUser i_Friend) { return(GreetingCardHandler.GetGreetingCard(i_Name, i_Friend).Form); }
internal static string GetFriendshipLength(FBUser.FBUser i_FriendToSend) { Random randomLength = new Random(); return(randomLength.Next(1, 15).ToString()); }
public static Form GetGreetingCard(string i_CardName, FBUser.FBUser i_Friend) { return(GreetingCardsUtils.GetGreetingCard(i_CardName, i_Friend)); }