public void CalculateStatisticsAboutFriends(FacebookAppEngine i_App)
        {
            FacebookObjectCollection <User> friendList = i_App?.FetchUserFriends();

            if (friendList != null && friendList.Count > 0)
            {
                friendList = filterListByChoice(friendList);
                m_StatisticData.TotalFriends = friendList.Count;

                foreach (User friend in friendList)
                {
                    friend.ReFetch(DynamicWrapper.eLoadOptions.FullWithConnections);
                    try
                    {
                        m_StatisticData.m_MenAndWomenStats.UpdateGenderCountersAccordingToGivenFriend(friend);
                        m_StatisticData.m_AgesStats.UpdateAgeRangesCountersAccordingToGivenUser(friend);
                        m_StatisticData.m_SocializingStats.UpdateFriendSocializedRanksAccordingToGivenUser(friend);
                    }
                    catch (Exception ex)
                    {
                        throw new Exception(FriendsStatisticsData.k_MissingFriendInfo, ex);
                    }
                }

                calculateAllRatios();
            }
            else if (friendList.Count == 0)
            {
                throw new Exception(FriendsStatisticsData.k_EmptyListMessage);
            }
            else
            {
                throw new Exception(FriendsStatisticsData.k_NullListMessage);
            }
        }
        public static FbAction Create(FacebookAppEngine i_Engine, eTasksType i_taskToAutomate)
        {
            FbAction res = null;

            switch (i_taskToAutomate)
            {
            case eTasksType.Status:
                res = FbActionPost.Create(i_Engine);
                break;

            case eTasksType.Photo:
                res = FbActionPhoto.Create(i_Engine);
                break;

            case eTasksType.Link:
                res = FbActionLink.Create(i_Engine);
                break;
            }

            return(res);
        }
示例#3
0
        public static TimedComponent Create(FbEventArgs i_Args, FacebookAppEngine i_Engine, eTasksType i_ChosenTask)
        {
            TimedComponent timedComponent = new TimedComponent {
                FbEventArgs = i_Args, ActionObject = FbActionFactory.Create(i_Engine, i_ChosenTask), Timer = new System.Timers.Timer(), Invoked = false
            };

            timedComponent.ActionObject.LoadAction();
            timedComponent.Timer.Enabled  = false;
            timedComponent.Timer.Elapsed += new System.Timers.ElapsedEventHandler(timedComponent.OnElapsed);

            if ((timedComponent.FbEventArgs.Time - DateTime.Now).TotalMilliseconds > 0)
            {
                timedComponent.Timer.Interval = (timedComponent.FbEventArgs.Time - DateTime.Now).TotalMilliseconds;
            }
            else
            {
                // if the time already passed, we commit the action immediately
                timedComponent.Timer.Interval = 0.1;
            }

            return(timedComponent);
        }
示例#4
0
 public static FbActionLink Create(FacebookAppEngine i_Engine)
 {
     return(new FbActionLink {
         m_Engine = i_Engine
     });
 }
 public static FbActionPhoto Create(FacebookAppEngine i_Engine)
 {
     return(new FbActionPhoto {
         m_Engine = i_Engine
     });
 }
示例#6
0
 public void PublishPost(string i_Text, FacebookAppEngine i_FacebookApp)
 {
     i_FacebookApp.PostStatus(string.Format(k_StatusMessage, CurrentFriendFullName, i_Text));
 }