Beispiel #1
0
        public bool Follow(User Follower, User Following)
        {
            bool result;

            // add user as follower
            result = Follower.Follow(Following);
            if (!result)
            {
                return false;
            }

            // notify user that they have an added follower
            result = Follower.FollowerAdded(Follower);
            if (!result)
            {
                return false;
            }

            // post that user is now following a new person
            result = Follower.FollowingTextPost(Following);
            if (!result)
            {
                return false;
            }

            // notify all of user's followers of new following activity
            result = Follower.NotifyFollowers(Following);
            if (!result)
            {
                return false;
            }

            return true;
        }
        public bool NotifyUser(User user, string message)
        {
            // code for notification
            // might be an SMS, email, internal app messaging, etc.

            return true;
        }
Beispiel #3
0
 public bool NotifyFollowers(User userToFollow)
 {
     bool result = true;
     Notification notification = new Notification();
     foreach (User follower in Followers)
     {
         // code for notifying followers of new activity
         result = notification.NotifyUser(this, this.UserName + " is now following " + userToFollow.UserName);
         if (!result)
         {
             break;
         }
     }
     return result;
 }
Beispiel #4
0
        private void btnFollowSomeone_Click(object sender, EventArgs e)
        {
            User me = new User();
            me.UserName = "******";

            User userIWantToFollow = new User();
            userIWantToFollow.UserName = "******";

            Follower follower = new Follower();
            if (follower.Follow(me, userIWantToFollow))
            {
                MessageBox.Show("You have successfully followed " + userIWantToFollow.UserName);
            }
            else
            {
                MessageBox.Show("Sorry, something went wrong.");
            }
        }
Beispiel #5
0
 public bool FollowingTextPost(User userToFollow)
 {
     // code for posting simple text
     Post post = new Post();
     return post.PostText(this, this.UserName + " is now following " + userToFollow.UserName);
 }
Beispiel #6
0
 public bool FollowerAdded(User newFollower)
 {
     // code for notifying user that they have an added follower
     Notification notification = new Notification();
     return notification.NotifyUser(this, newFollower.UserName + " is now following you!");
 }
Beispiel #7
0
        public bool Follow(User userToFollow)
        {
            // code for adding you as a follower

            return true;
        }
Beispiel #8
0
        public bool PostText(User user, string message)
        {
            // code for posting simple text

            return true;
        }