private void fetchfriends()
        {
            listBoxFriends.Invoke(new Action(() =>
            {
                string unknowUserPicUrl = "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcRg7sqvEEQjipFVPNEuizNSE_KhUBY5IgwkOkUNU3of52M47X7F";
                this.FriendpictureBox.LoadAsync(unknowUserPicUrl);
                this.listBoxFriends.Items.Clear();
                const int k_Zero = 0;
                List <string> friendsNameList = LoggedInUser.Instance().GetFreindsNames();
                if (friendsNameList.Count > k_Zero)
                {
                    foreach (string friendName in friendsNameList)
                    {
                        listBoxFriends.Items.Add(friendName);
                    }
                }

                else
                {
                    string haveNoFriendError = string.Format("{0} dont have any friends", LoggedInUser.Instance().GetFirstName());
                    listBoxFriends.Items.Add(haveNoFriendError);
                }
            }
                                             ));
        }
        private void fetSelectedFrindPic()
        {
            string PictureLargeURL;
            string selectedFriend = listBoxFriends.SelectedItem.ToString();

            PictureLargeURL = LoggedInUser.Instance().GetImageUrlBySelectedFriend(selectedFriend);
            if (PictureLargeURL != null)
            {
                FriendpictureBox.LoadAsync(PictureLargeURL);
            }
            else
            {
                FriendpictureBox.Image = FriendpictureBox.ErrorImage;
            }
        }
Exemplo n.º 3
0
 private void buttonLogin_Click(object sender, EventArgs e)
 {
     try
     {
         if (LoggedInUser.Instance().IsUserConnected())
         {
             m_IsLoggedIn = true;
         }
         if (m_IsLoggedIn == true)
         {
             this.Close();
         }
     }
     catch
     {
         MessageBox.Show("Login Failed please try again");
     }
 }
        private void loadCheckins()
        {
            ListViewItem tempItem;

            this.Invoke(new Action(() =>
            {
                List <ISpecialCheckin> specialCheckin        = LoggedInUser.Instance().GetAllCheckins();
                List <ISpecialCheckin> SoretedspecialCheckin = specialCheckin.OrderByDescending(s => s.NumOfLikes).ToList();
                foreach (ISpecialCheckin sp in SoretedspecialCheckin)
                {
                    specificCheckIn = sp as SpecialCheckin;
                    tempItem        = new ListViewItem(sp.Id);
                    tempItem.SubItems.Add(sp.Place);
                    tempItem.SubItems.Add(sp.NumOfLikes.ToString());
                    listViewCheckins.Items.Add(tempItem);
                }
            }));
        }
 private void greatingYourFriends()
 {
     try
     {
         const int k_zero = 0;
         List <Dictionary <string, string> > friends = LoggedInUser.Instance().BlessFriendWhoHaveABirthDay();
         if (friends.Count > k_zero)
         {
             foreach (Dictionary <string, string> friend in friends)
             {
                 listBoxGreeting.Items.Add(friend.Keys.ToString());
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
        private void saveUserBless()
        {
            try
            {
                bool isFemaleBless = false;
                if (this.checkBoxIsFemaleBlessing.Checked)
                {
                    isFemaleBless = true;
                }

                LoggedInUser.Instance().SaveUserBlessings(isFemaleBless, textBoxBlessing.Text);
                textBoxBlessing.Text = string.Empty;
                MessageBox.Show("Blessing was saved");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
 private void updateFriendPhotoBySearch()
 {
     try
     {
         string friendUrl = LoggedInUser.Instance().GetImageUrlBySelectedFriend(listBoxSearchResults.SelectedItem.ToString());
         if (friendUrl != null)
         {
             FriendpictureBox.LoadAsync(friendUrl);
         }
         else
         {
             const string k_NoPicUrl = "https://i.imgur.com/8EMJr2i.png";
             FriendpictureBox.LoadAsync(k_NoPicUrl);
             MessageBox.Show("This friend don't have permissions in your app");
         }
     }
     catch (Exception e)
     {
         MessageBox.Show("You dont have permissions to see this freind picture");
     }
 }
 private void PostButton_Click(object sender, EventArgs e)
 {
     LoggedInUser.Instance().PostStatus(PostextBox.Text);
     PostextBox.Text = string.Empty;
 }
 private void updateUserName()
 {
     FirsrNamelabel.Invoke(new Action(() => { FirsrNamelabel.Text = LoggedInUser.Instance().GetFirstName(); }));
     LastNamelabel.Invoke(new Action(() => { LastNamelabel.Text = LoggedInUser.Instance().GetLastName(); }));
 }
 private void updateCoverPicture()
 {
     CoverpictureBox.Invoke(new Action(() => { CoverpictureBox.LoadAsync(LoggedInUser.Instance().GetCoverPicture()); }));
 }
 private void updateProfilePicture()
 {
     ProfielpictureBox.Invoke(new Action(() => { ProfielpictureBox.LoadAsync(LoggedInUser.Instance().GetProfilePicture()); }));
 }
 private void loadMorePostToWall()
 {
     m_LastPostIndexToGet = LoggedInUser.Instance().GetLastPostIndex();
     updateWall();
 }
 private void getAllPost()
 {
     m_Posts = LoggedInUser.Instance().GetPostsData(0);
 }